Jump to content

PHP Help - query is showing null


Padgoi

Recommended Posts

Hi everyone,

So I have this code and the first part of it works fine, but the $q part of it is just displaying null.  Can anyone help me with this:

 

function eatbox()
{

$pop = mysql_query( "select starter_name, count(*) as replies from ibf_posts join ibf_topics on tid=topic_id where new_topic=0 group by starter_name order by replies desc LIMIT 25" )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($pop);
$this->output .= "<table border=1>\n";
while ($get_info = mysql_fetch_row($pop)){
$this->output .= "<tr>\n";
foreach ($get_info as $field)
{$this->output .= "\t<td><font face=arial size=1/>$field</font></td>\n";}
$q = "select count(*) as topics from ibf_topics where starter_name = '".$get_info['starter_name']."'";
$poop = mysql_query( $q) or die("SELECT Error: ".mysql_error());
$get_topics = mysql_fetch_row($poop));
$this->output .= "\t<td><font face=arial size=1/>$get_topics['topics']</font></td>\n";
$this->output .= "</tr>\n";


}

Link to comment
Share on other sites

I hope you have one topic_id column or that's going to be an ambiguous column in your JOIN statement. Is that doing what you want it to do?

 

Yeah, that is working fine, the first part of the query works fine, it's the second part, the $q and $poop parts that are displaying null.  Please help?

Link to comment
Share on other sites

$q = "select count(*) as topics from ibf_topics where starter_name = '".$get_info['starter_name']."'";

 

 

That line should be: $q = "select count(*) as topics from ibf_topics where starter_name = '".$field['starter_name']."'";

 

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.