Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Echoing information from query - not working

Spacemail by SpaceshipSpacemail by Spaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Watch

liam_d

The original NP Emo KidEstablished Member
Impact
25
Hi all before i get started here is the background of what this script does; Basicly it checks the last post of a forum i made (http://www.emoforums.net/forum/) and what it does is check for the last post in the forum, if it has replies then select the last info from the replies table if not then use the previous query which takes it from the topics table the problem is that if there is no replies then the $last_info2 doesnt work.

PHP:
		// to find out if a the latest topic has a reply
		$find_topic = mysql_fetch_array(mysql_query("SELECT * FROM `forum_topics` WHERE `forumroot` = '" . $display['id'] . "' ORDER BY `lastdate` DESC LIMIT 1"));
		
		$find_replies = mysql_fetch_array(mysql_query("SELECT COUNT(replies) AS `count` FROM `forum_topics` WHERE `forumroot` = '" . $display['id'] . "' ORDER BY `lastdate` DESC LIMIT 1"));
		if ($find_replies['count'] >= '1')
		{
			$last_info = mysql_fetch_array(mysql_query("SELECT * FROM `forum_replies` WHERE `topic_id` = '" . $find_topic['id'] . "' ORDER BY `id` DESC LIMIT 1"));
			$last_info2 = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '" . $last_info['starter_id'] . "'"));
			$last_info['topic'] = $find_topic['topic'];
		}
		
		else
		{
			$last_info = $find_topic;
			$last_info2 = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '" . $last_info['starter_id'] . "'"));
		}
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back