Jump to content

Displaying MySql Results table side by side


richiejones24

Recommended Posts

need a little help guys! I use the script below to display profile images, trouble is it shows 1 on top of the other, and i need it to double up 2 profile images on top of 2 profile images ect any ideas how i can do this. 

 


require("./include/mysqldb.php");

$con = mysql_connect("$dbhost","$dbuser","$dbpass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("$dbame", $con);
$result = mysql_query("SELECT * FROM Search_profiles_up WHERE upgrade_one ='1' ORDER BY RAND() LIMIT 40");


print "<table width=\"293\" height=\"111\" border=\"0\">
  <tr>\n";

while($row = mysql_fetch_array($result))
  {
print "<td width=\"142\"><img src=" . $row['search_small_image'] . " width=\"144\" height=\"169\" /></td>\n";
print "  </tr>\n";
print "  <tr>  \n";
print "<td>" . $row['star'] . "</td>\n";
print "  </tr>\n";
print "  <tr>\n";
print "<td>" . $row['username_search'] . "</td>\n";
print "  </tr>\n";
print "  <tr>  \n";
print "<td>" . $row['phone_search'] . "</td>\n";
print "  </tr>   \n";

  }
print "</table>";

mysql_close($con);
?>


Link to comment
Share on other sites

Try this:

<?php
require("./include/mysqldb.php");

$con = mysql_connect("$dbhost","$dbuser","$dbpass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("$dbame", $con);
$result = mysql_query("SELECT * FROM Search_profiles_up WHERE upgrade_one ='1' ORDER BY RAND() LIMIT 40");

print "<table width=\"293\" height=\"111\" border=\"0\">
	<tr>";
$right = false;
while($row = mysql_fetch_array($result))
  {
print "<td width=\"142\"><img src=" . $row['search_small_image'] . " width=\"144\" height=\"169\" /><br />";
	. $row['star'] . "<br />"
	. $row['username_search'] . "<br />";
	. $row['phone_search'] . "</td>";
if($right)
{
	print "</tr><tr>";
}
$right=!$right;
  }
print "</tr></table>";

mysql_close($con);
?>

Link to comment
Share on other sites

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.