0

可能重复:
mysql_fetch_array() 期望参数 1 是资源,选择中给出的布尔值

我有 :

$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

不知道为什么,谁能帮帮我

4

2 回答 2

2

用反引号包裹你的所有`

 `student-`.`ClassSize_8`

因为-在你的列名中

建议:将您的表名从更改student-student

于 2012-06-25T10:59:07.417 回答
0

你需要从列表中完成

 $sql = "... fresh_en.num_appl_received FROM school,student-, degree_o,accredit ,fresh_en 
INNER JOIN ...";
于 2012-06-25T11:07:19.693 回答