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"; } Link to comment https://forums.phpfreaks.com/topic/159164-php-help-query-is-showing-null/ 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? Link to comment https://forums.phpfreaks.com/topic/159164-php-help-query-is-showing-null/#findComment-839401 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? Link to comment https://forums.phpfreaks.com/topic/159164-php-help-query-is-showing-null/#findComment-839402 Share on other sites More sharing options...
dennismonsewicz Posted May 21, 2009 Share Posted May 21, 2009 replace $get_info with $field Link to comment https://forums.phpfreaks.com/topic/159164-php-help-query-is-showing-null/#findComment-839405 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. Link to comment https://forums.phpfreaks.com/topic/159164-php-help-query-is-showing-null/#findComment-839534 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']."'"; Link to comment https://forums.phpfreaks.com/topic/159164-php-help-query-is-showing-null/#findComment-839547 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. Link to comment https://forums.phpfreaks.com/topic/159164-php-help-query-is-showing-null/#findComment-839958 Share on other sites More sharing options...
dennismonsewicz Posted May 22, 2009 Share Posted May 22, 2009 try echoing out $q Link to comment https://forums.phpfreaks.com/topic/159164-php-help-query-is-showing-null/#findComment-839963 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. Link to comment https://forums.phpfreaks.com/topic/159164-php-help-query-is-showing-null/#findComment-840005 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.