2012-05-25 23 views
-1

是我簡單的SQL查詢:mysql_fetch_array預計這裏參數

<?php 
// making the database connection 
    $db2=mysql_connect("localhost","root",""); 
    mysql_select_db("my_requests",$db2); 
    $x=time(); 
    $query=mysql_query("SELECT * FROM 'details' INNER JOIN 'product' ON details.user_id = product.user_id"); // find the city 
    $row=mysql_fetch_array($query);// save record 

    // extract city id 
    echo "$row"; 

每當我運行此腳本它說,

警告:mysql_fetch_array()預計參數1是資源, 布爾在給定的C:\ XAMPP \ htdocs中\ my_cityway \ timeout.php線路7

它在哪兒去了?

+1

這個問題有被問了這麼多次,不可能選擇最準確的副本......爲什麼它仍然是upvoted? – DCoder

+0

爲什麼不在問這裏之前回答google?它已被回答1000次,首先在谷歌上查詢返回幾個SO答案。另外,試圖自行解決它的是什麼?你想知道爲什麼它不起作用,或者你只是想讓它工作? –

回答

1

你正在使用錯誤的引號

` is different that ' 

看看這張截圖enter image description here

由於這個原因,內部連接是沒有返回值,您將收到一個錯誤信息,還可以使無報價查詢所有

enter image description here

2

表的名字不應該是引號裏的 '細節' S | b

 `details` or details 
1

請刪除周圍的表名引號,並使用

print_r($row) 

顯示該行

相關問題