2010-02-17 82 views

回答

3

您直接將查詢傳遞給函數。它存儲在一個變量,如果你想呼應它:

$query = "SELECT 

    car.id  car_id, 


FROM 
    car 

WHERE car.id= $id "; 
echo $query; 
$result = mysql_query($query); 
+0

謝謝伊格納西奧 – jona 2010-02-17 05:23:45

0

以上回答將回聲查詢的結果,如果你只是想呼應的查詢字符串本身,它首先存儲爲一個字符串,通過串入的mysql_query功能,呼應字符串:

$sql = "SELECT car.id car_id, FROM car WHERE car.id= $id"; 
echo $sql;  
$result = mysql_query($sql); 
+0

謝謝你小子該信息... – jona 2010-02-17 05:03:08

2
$query = "SELECT car.id,car_id FROM car WHERE car.id= $id "; 
$result = mysql_query($query) 
while ($car_details = mysql_fetch_array($result)){ 
    echo "$car_details[id], $car_details[car_id]\n"; 
} 
+0

謝謝你的信息的人... – jona 2010-02-17 05:05:08