看板 PHP 關於我們 聯絡資訊
function get_tenant_list() { $link = mysql_pconnect("localhost", "xxxxx", "xxxxx"); mysql_select_db ("xxxxx", $link) ; $sql = "select * from houses where type_='上架' "; $ret = mysql_query($sql, $link) ; $rec=array( array(),array() ); $a1=0; 51行 while($value = mysql_fetch_array( $ret)) { $rec[$a1][0]=$value[0]; $rec[$a1][1]=$value[2]; $a1++; } mysql_close ($link) ; return $rec; } function get_tenant_un() { $link = mysql_pconnect("localhost", "xxxxx", "xxxxxx"); mysql_select_db ("xxxxxx", $link) ; $sql = "select * from houses where type_='上架' "; $ret = mysql_query($sql, $link) ; $a1=0; 71行 while($value = mysql_fetch_array( $ret)) { $a1++; } mysql_close ($link) ; return $a1; } Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\show_tenant.php on line 51 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\show_tenant.php on line 71 請大大能否幫我看一下那裡出了問題,謝謝。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 163.21.78.223
yuleen123:如果是 MySQL 的話會不會是 $sql 後面沒加 ; 11/13 14:05
yuleen123:另外 query 後檢查一下回傳值比較好 11/13 14:06
kyowinner:把sql語法印出來到phpmyadmin試試看 11/13 14:32
aqzb:我不是很熟 where type_='上架' 其中 type_ 是有這欄位嗎? 11/13 14:37
buganini:echo mysql_error(); 11/13 14:43
opoepev:推上二樓~應該是要檢查一下是不是有type_←這個欄位... 11/13 15:12