Jump to content

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


DaveLinger

Recommended Posts

[code]<html>
<head>
<link href="resultcss.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
include('config/file.php');

$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';
  exit;
}

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

if($fletter == '%'){
$query="SELECT * FROM nuke_seccont WHERE secid LIKE '$platform' AND developer LIKE '$developer' AND publisher LIKE '$publisher' ORDER BY $sortby $order";
}ELSE{
$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!";
}else{
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>";

$i=0;
while ($i < $numberofresults) {

$aid=mysql_result($result,$i,"aid");
$artid=mysql_result($result,$i,"artid");
$secid=mysql_result($result,$i,"secid");
$title=mysql_result($result,$i,"title");
$counter=mysql_result($result,$i,"counter");
$score6=mysql_result($result,$i,"score6");
$releasedate=mysql_result($result,$i,"releasedate");
$publishdate=mysql_result($result,$i,"publishdate");

include('includes/platforms.php');

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>";

$i++;
}
echo "</table>";
}
?>
</body>
</html>[/code]

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

6.587.29

then the table... with empty spots where I TOLD it to echo score6.
Link to comment
Share on other sites

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

[code]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>";[/code]

See anything wrong there?

[code]$score6<td></td>[/code]
should be
[code]<td>$score6</td>[/code]
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.