creativkook Posted April 1, 2006 Share Posted April 1, 2006 I keep getting this error that my fetch arrays are not a valid resource for the two located near the bottom of my code, the ones hilighted. Can anyone see what I'm doing wrong? I'm trying to pull out entries for a simple forum, using three database tables that tie together. Thanks!<?phprequire("dbheader.php");$topic = mysql_fetch_array(mysql_query("SELECT topic FROM topics WHERE topicid = $_GET[topicid]"));echo(mysql_error());$title = $topic['topic'];$entries = mysql_query("SELECT *, UNIX_TIMESTAMP(eventTime) AS utime FROM entry WHERE topicid = $_GET[topicid]");?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title><?php echo($title); ?></title><link href="style.css" rel="stylesheet" type="text/css" /></head><body><?php [b]$entry = mysql_fetch_array($entries);[/b] $userid = $entry['userid']; [b]$user = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE userid = $userid"));[/b] $edate = date("l, F jS", $entry['utime']); $etime = date("g:i a", $entry['utime']); while($entry) { echo("<div class='display'"); echo("<table cellpadding='3' cellspacing='3'>"); echo("<tr>"); echo("<td>"); echo("<p>$user[username]</p>"); echo("<p>$edate at $etime</p>"); echo("</td>"); echo("<td>"); echo("<p>$entry[entry]</p>"); echo("</td>"); echo("</tr>"); echo("</div>"); }?></body></html> Quote Link to comment Share on other sites More sharing options...
craygo Posted April 1, 2006 Share Posted April 1, 2006 You should break up your queries to narrow down errors. When you get that error usually it is a problem with your query. try enclosing the value in your where clause like below.[code]$sql = "SELECT topic FROM topics WHERE topicid = ".$_GET[topicid]."";$result = mysql_query($sql) or die (mysql_error());[/code]Ray Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.