开发者

mysql php where clause not working

Any ideas why this wouldnt work!?

Just nothing displays..

$result1 = mysql_query("select * from `suppliers` where supp_short_code='WED'") or die(mysql_error());
                while($row1 = mysql_fetch_array($result1))
                    {       
                        echo "<p>" . $row1['supp_name'] . "</p>";
             开发者_JS百科       } 


Resolved! turns out when i imported from Excel to my mysql in brought in spaces after and before the "supp_short_code" so the query wasnt working!


Is 'supp_name' a column of your 'suppliers' table?

Does this query return any result under phpmyadmin eg?

Are the <p> tags displayed (no rules as display:none;)?


Where is your connection? If there isn't one, mysql_query() tries to make one by calling mysql_connect() with no args. It also fails if your connection doesn't have permissions for the table you're trying to read. If it's not dying but only returning no result, then check mysql_num_rows()


correct quotes of this line :: $result1 = mysql_query("select * from suppliers where supp_short_code='WED'") or die(mysql_error());

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜