Jump to content

[SOLVED] Guys, what am I doing wrong?


ballhogjoni

Recommended Posts

I have this code here, but it only shows the first record in the db. I know there are multiple records that meet this criteria. What am I doing wrong?

 

$query = mysql_query("SELECT email, fname, lname FROM pageOneInfo_Test WHERE date = '".$date."' AND soldProductTo = '0'") or die(mysql_error());
$row = mysql_fetch_array($query);
echo $row['email'].'<br>'.$row['fname'];

Link to comment
https://forums.phpfreaks.com/topic/89103-solved-guys-what-am-i-doing-wrong/
Share on other sites

You need to throw it in a while statement.

 

<?php
$query = mysql_query("SELECT email, fname, lname FROM pageOneInfo_Test WHERE date = '".$date."' AND soldProductTo = '0'") or die(mysql_error());
while($row = mysql_fetch_assoc($query)){
  extract($row);
  echo $email.'<br>'.$fname;
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.