Jump to content


very strange SQL problem... echoes all results when not called?

  • Please log in to reply
2 replies to this topic

#1 DaveLinger

  • Members
  • PipPipPip
  • Advanced Member
  • 268 posts
  • LocationWV, USA

Posted 07 August 2006 - 02:35 AM

<link href="resultcss.css" rel="stylesheet" type="text/css" />

$platform = $_POST['platform'];
$developer = $_POST['developer'];
$publisher = $_POST['publisher'];
$fletter = $_POST['fletter'];
$sortby = $_POST['sort'];
$perpage = $_POST['perpage'];
$order = $_POST['order'];

if (!$link = mysql_connect($sqlserver, $sqlusername, $sqlpassword)) {
   echo 'Could not connect to mysql';

if (!mysql_select_db($sqldatabase, $link)) {
   echo 'Could not select database';

if($fletter == '%'){
$query="SELECT * FROM nuke_seccont WHERE secid LIKE '$platform' AND developer LIKE '$developer' AND publisher LIKE '$publisher' ORDER BY $sortby $order";
$query="SELECT * FROM nuke_seccont WHERE secid LIKE '$platform' AND developer LIKE '$developer' AND publisher LIKE '$publisher' AND fletter='$fletter' ORDER BY $sortby $order";
$result = mysql_query($query) or die("Problem with the query: $query<br>" . mysql_error());

$numberofresults = mysql_num_rows($result);

if($numberofresults == '0'){
echo "<br>No results found matching the criteria specified!";
echo "<br><p align=\"left\">Search successful! $numberofresults results found.</p>";
echo "<table width=\"100%\" border=\"1\" style=\"border-collapse: collapse\"><tr><td><b>Game Title</b></td><td><b>Final Score</b></td><td><b>Author</b></td><td><b>Platform</b></td><td><b>Release Date</b></td><td><b>Publish Date</b></td><td><b>Hits</b></td></tr>";

while ($i < $numberofresults) {



echo "<tr><td height=\"30\">● <a href=\"review.php?artid=$artid\" target=\"_parent\"><b>$title</b></a></td>$score6<td></td><td>$aid</td><td>$section</td><td>$releasedate</td><td>$publishdate</td><td>$counter</td></tr>";

echo "</table>";

Everything works EXCEPT... it echoes every score6 result right before the table starts. So if some score6 results were 6.5, 8, 7.2, and 9, it would echo


then the table... with empty spots where I TOLD it to echo score6.
dave at linger dot com

#2 hitman6003

  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 07 August 2006 - 02:40 AM

Look at your echo line.  Specifically where you are echoing out the $score6 in the html.

echo "
		<td height=\"30\">● <a href=\"review.php?artid=$artid\" target=\"_parent\"><b>$title</b></a></td>

See anything wrong there?

should be

#3 xec

  • Members
  • PipPip
  • Member
  • 23 posts

Posted 07 August 2006 - 05:08 AM

EDITED BY akitchin:  provided code that was both useless and wrong.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users