Jump to content

i need help with my code


key

Recommended Posts

I keep get this error how do i fix it//gather the topics

 

 

$get_topics_sql = "SELECT topic_id, topic_title,

DATE_FORMAT(topic_create_time,  '%b %e %Y at %r') AS fmt_topic_create_time, topic_owner FROM forum_topics ORDER BY topic_create_time DESC";

:-[::::::on this line of code    $get_topic_res = mysql_query($mysql, $get_topic_sql)

or die(mysql_error($mysql));

 

if (mysqli_num_rows($get_topic_res) < 1) {

//there are no topics, so say so

$display_block = "<p><em>No topics exist.</em></p>";

} else {

//create the display string

$display_block = "

<table cellpadding=\"3\" cellspacing=\"1\" border=\"1\">

<tr>

<th>TOPIC TITLE</th>

<th># of POSTS</th>

</tr>";

Link to comment
https://forums.phpfreaks.com/topic/116906-i-need-help-with-my-code/
Share on other sites

$get_topic_res = mysql_query($mysql, $get_topics_sql) or die(mysql_error($mysql));

 

You need to reverse the variables in your mysql_query argument.  The argument should be querystring, connection

 

$get_topic_res = mysql_query($get_topics_sql, $mysql) or die(mysql_error($mysql));

 

You also forgot the "s" in "topic".  But that may not fix the problem.  It for sure needs to be that way, but that may or may not be your only problem.  If it still doesn't work (don't change it back), post the error.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.