作者roger70349 (roger70349)
看板PHP
标题[请益] php的问题
时间Tue Nov 13 13:49:00 2007
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
1F:→ yuleen123:如果是 MySQL 的话会不会是 $sql 後面没加 ; 11/13 14:05
2F:→ yuleen123:另外 query 後检查一下回传值比较好 11/13 14:06
3F:推 kyowinner:把sql语法印出来到phpmyadmin试试看 11/13 14:32
4F:推 aqzb:我不是很熟 where type_='上架' 其中 type_ 是有这栏位吗? 11/13 14:37
5F:推 buganini:echo mysql_error(); 11/13 14:43
6F:推 opoepev:推上二楼~应该是要检查一下是不是有type_←这个栏位... 11/13 15:12