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);
?>


Not certain what you mean. You didn't really describe it the best. Image reference maybe of what you want? (Can be basic and quick, made in mspaint or something)

 

Are you effectively wanting profile images like this

;):shy:

 

but you are getting them like this

;)

:shy:

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);
?>

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.