Reputation: 37504
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>";
}
Upvotes: 1
Views: 1862
Reputation: 822
correct quotes of this line :: $result1 = mysql_query("select * from suppliers where supp_short_code='WED'") or die(mysql_error());
Upvotes: 0
Reputation: 37504
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!
Upvotes: 2
Reputation: 20446
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()
Upvotes: 0
Reputation: 18761
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;
)?
Upvotes: 1