Jump to content


Help creating a table???

  • Please log in to reply
1 reply to this topic

#1 ChrisLawrie

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 02 December 2003 - 01:58 AM

Hi all i need help!

I am trying to create a table of 10 latest posts from my forums on the first page of my site. I have tried the following code but errors occur:

<h1>LAST 10 POSTS</h1>
<table border=\"1\">
<td class=\"white\"><strong>Topic ID</strong></td>
<td class=\"white\"><strong>Topic Title</strong></td>
<td class=\"white\"><strong>Topic Time</strong></td>
<td class=\"white\"><strong>Topic Views</strong></td>
<td class=\"white\"><strong>Forum ID</strong></td>
<td class=\"white\"><strong>Forum Name</strong></td>
<td class=\"white\"><strong>User Name</strong></td>
$query=\"SELECT topic_id, topic_title, topic_time, topic_views, t.forum_id, f.forum_name, u.uname FROM \".$mpnTables.\" t, \".$mpnTables.\" f, \".$mpnTables.\" u where (f.forum_id=t.forum_id) and (forum_type \'1\') and (t.last_post=u.uid) ORDER BY topic_time desc LIMIT 10\";
<td class=\"white\"><?php print($row[0]);?></td>
<td class=\"white\"><?php print($row[1]);?></td>
<td class=\"white\"><?php print($row[2]);?></td>
<td class=\"white\"><?php print($row[3]);?></td>
<td class=\"white\"><?php print($row[4]);?></td>
<td class=\"white\"><?php print($row[5]);?></td>
<td class=\"white\"><?php print($row[6]);?></td>

Gives following errors:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in ***/index2.php on line 170

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in ***/index2.php on line 183

Any suggestions anyone?
My tables are called: mpn_topics, mpn_forums,mpn_users.


#2 shivabharat

  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 02 December 2003 - 06:13 PM

The porblem is in the query

Try this

$result=mysql_db_query("***",$query) or die(mysql_error());

You will get an idea what the error is.
Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users