2013-05-22 16 views
-4

錯誤意外T_STRING在3線:由$ SQL開始解析錯誤:語法錯誤,在3號線

<?php 

    $sql = mysql_query("SELECT `sub_id` FROM `subject_studant` WHERE `std_id` = 2 ") or die mysql error(); 
    while($row=mysql_fetch_assoc($sql)) 
    { 
     $sub_id1 = $row['sub_id']; 
     echo $sub_id1; 
    } 
?> 
+3

不推薦使用mysql,函數名稱爲mysql_error,不能有空格 – Sam

回答

4

你錯過了一個下劃線。 mysql_error()是一個函數名稱,它包含一個下劃線。