I have a problem with MySqli not outputting the result of my query.
$cxn=mysqli_connect($host,$user,$pw,$dbname) or die("Error connecting to server");
if(!$cxn=mysqli_connect($host,$user,$pw,$dbname)){
$message=mysqli_error($cxn);
echo $message;
die();
}
$query= "SELECT * from merchantinfo WHERE industry='Retail'";
$result=mysqli_query($cxn,$query) or die("Could not execute the query");
$row=mysqli_fetch_assoc($result);
while($row = mysqli_fetch_assoc($result))
{
extract($row);
echo "$INDUSTRY: $NAME<br/>";
}
And this is the table i'm currently using.(merchantinfo)
MerchantID INDUSTRY NAME DESCRIPTION
1 Dining Burger King Whopper,Whoppers galore!
2 Retail ZARA A large clothing retailer
3 Aviation Virgin Airlines Lolwut
i am currently getting a totally blank page as my result after my query, though i cant seem to figure out the problem. i've tried changing the 'industry' in $query and the while loop to all caps to match the capitalisation in the table, i've also tried using them all in small caps. Yet i am still getting a blank page as a output.
I've also tried changing the $query to
$query="SELECT * FROM merchantinfo";
which produces the result :
Retail:ZARA
Aviation:Virgin Airlines
i would appreciate it if someone could point out the mistake in the code or point me in the right direction
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…