Jump to content

Showing multiple records in a row from MYSQL


Go to solution Solved by mikosiko,

Recommended Posts

I am new and trying to figure out a way to take my records from the data base and display 4 to a row instead of just one record at a time...

 

Here is the code I am working with.

$query = "select * from products";
$result = mysql_query($query);

echo "<table width=\"100%\" border=\"0\" align=\"center\">\n"; 

while($row=mysql_fetch_array($result, MYSQL_ASSOC))
{
	$prodid = $row['prodid'];
	$description = $row['description'];
	$price = $row['price'];
	$quantity = $row['quantity'];
	


	echo "<tr><td align = \"center\">\n";
	echo "<tr><td><img src=\"showimage.php?id=$prodid\" width=\"80\" height = \"80\">\n</br>";
	echo  "<a href=\"updatecart.inc.php?id=$prodid\"> $description </a>" ;
	echo "</td></tr>\n";
}
echo "</table>\n";

?>

I thank you in advance for your help.

 

 

  • Solution

Did you look on the Sticky folders ?... per example: http://forums.phpfreaks.com/forum/32-faqcode-snippet-repository/

 

or make a search? this topic has been discussed many...many times before and several times solutions has been posted.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.