Jump to content


Photo

SQL query producing random result...


  • Please log in to reply
2 replies to this topic

#1 DaveLinger

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

Posted 05 August 2006 - 12:22 AM

$query="SELECT *, DATE_FORMAT(time, '%W, %M %D') AS my_date FROM nuke_stories WHERE sid = $sid";
$result = mysql_query($query) or die("Problem with the query: $query<br>" . mysql_error());

mysql_close();

while ($row = mysql_fetch_assoc($result))
{
$sid = $row['sid'];
$aid = $row['aid'];
$title = $row['title'];
$hometext = $row['hometext'];
$my_date = $row['my_date'];

echo "<html><head><title>$title - $sitename</title><link href=\"http://www.gamefreaks365.com/css.css\" rel=\"stylesheet\" type=\"text/css\" /></head>";

include('includes/header2.php');

echo "$title";
$i++;
}

the FIRST time I echo $title it's correct. The second time it's a random result!
http://www.DaveLinger.com
dave at linger dot com

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 05 August 2006 - 12:43 AM

What do you mean by "a random result"? What's in the file header2.php? What happens if you remove the "mysql_closer()" line, which you really don't need.

Ken

#3 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 05 August 2006 - 03:43 AM

i think you have something in header2.php that overrid $title
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users