Associative arrays and looping through mysql query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

and you're quite sure the fields exist and aren't empty?

Code: Select all

$SQL = mysql_query("SELECT IF(LENGTH(name)>0,name,'<empty>') AS name, IF(LENGTH(email)>0,email,'<empty>') AS email FROM am_users") or die(mysql_error);
$nrows = mysql_num_rows($SQL);
while($Data = mysql_fetch_assoc($SQL))
	$main .= '<p style="border: 1px solid silver">' . "$Data[name] -  $Data[email]" . '</p>';

$main .= $nrows;
User avatar
mikusan
Forum Contributor
Posts: 247
Joined: Thu May 01, 2003 1:48 pm

Post by mikusan »

I fixed it thanks alot... i had a problem that arose deep inside my script that never gave any errors but that cause this one adn some others to not work...all is fine now... thank you very much...
Post Reply