Jump to content

php mysql_query return multiple rows


dzedward

Recommended Posts

if you want to loop though all the entries use this

<?php
echo '<pre>';
$sql = mysql_query("SELECT * FROM $my_table WHERE username='$user'");
if (mysql_num_rows($sql) > 0) {
while($data = mysql_fetch_array($sql)) {
	print_r($data);
}
} else {
echo 'No Results';
}
echo '</pre>';
?>

 

That will print the results for each match found

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.