我尝试使用mysql_fetch_array使用此代码
获取我的所有数据while($row = mysql_fetch_array($sql)){
if($row_counter % 2){
$row_color="bgcolor='#FFFFFF'";
}else{
$row_color="bgcolor='#F3F6F8'";
}
echo "<tr class=\"TrColor\" ".$row_color.">";
echo "<td>" . $row['wipo_applicant1_city'] . "</td>\n";
echo "<td>" . $row['applicant1_addr1'] . "</td>\n";
echo "<td>" . $row['wipo_applicant1_state'] . "</td>\n";
echo "<td>$" . $row['invention-title'] . "</td>\n";
echo "</tr>";
$row_counter++;
}
但我收到了错误
syntax error, unexpected T_WHILE, expecting ',' or ';'
在这一行
while($row = mysql_fetch_array($sql)){
谁知道那条线有什么问题?
答案 0 :(得分:2)
听起来你错过了那之前的;
或,
。
答案 1 :(得分:2)
while
循环之前的行末尾没有分号;
echo 'Whatever' //<--- You must be missing a semi-colon here
while($row = mysql_fetch_array($sql)){ //<----- So not exactly this line, but the line before