Padgoi Posted May 21, 2009 Share Posted May 21, 2009 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"; } Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 21, 2009 Share Posted May 21, 2009 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? Quote Link to comment Share on other sites More sharing options...
Padgoi Posted May 21, 2009 Author Share Posted May 21, 2009 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? Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted May 21, 2009 Share Posted May 21, 2009 replace $get_info with $field Quote Link to comment Share on other sites More sharing options...
Padgoi Posted May 22, 2009 Author Share Posted May 22, 2009 replace $get_info with $field Which one? I replaced the last one, that didn't work, still null. Quote Link to comment Share on other sites More sharing options...
Batosi Posted May 22, 2009 Share Posted May 22, 2009 $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']."'"; Quote Link to comment Share on other sites More sharing options...
Padgoi Posted May 22, 2009 Author Share Posted May 22, 2009 Thanks Batosi, but it's still null. Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted May 22, 2009 Share Posted May 22, 2009 try echoing out $q Quote Link to comment Share on other sites More sharing options...
Padgoi Posted May 22, 2009 Author Share Posted May 22, 2009 try echoing out $q Getting a bunch of resource id's. 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.