可能重复:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select
我有:
$connector = new DBconnector();
$sql = "SELECT school.name, student-.ClassSize_7, student-.ClassSize_8, degree_o.degree_code, accredit.full_faculty_3,
accredit.total_faculty_3, accredit.pc_terminal, accredit.stud_fac_ratio, fresh_en.num_appl_offered, fresh_en.num_appl_received FROM school
INNER JOIN student- ON school.scid = student-.scid
INNER JOIN degree_o ON school.scid = degree_o.scid
INNER JOIN accredit ON school.scid = accredit.scid
INNER JOIN fresh_en ON school.scid = fresh_en.scid
ORDER BY school.name ASC LIMIT 0, 25";
$result = $connector->query($sql);
//$numberRows = $connector->numRows($result);
$numRows = mysql_num_fields($result);
我的查询没有返回任何结果,我收到这样的警告:
Warning: mysql_num_fields() expects parameter 1 to be resource, boolean given in C:\wamp\www\...\academics.php on line 17
和
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\...\academics.php on line 96
我不知道为什么,任何人都可以帮助我
答案 0 :(得分:2)
用反引号`
包裹所有列,如
`student-`.`ClassSize_8`
因为您的列名称中有-
建议:将您的表名从student-
更改为student
答案 1 :(得分:0)
您需要从列表中完成
$sql = "... fresh_en.num_appl_received FROM school,student-, degree_o,accredit ,fresh_en
INNER JOIN ...";