FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » FUDapi - Wiki example
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
FUDapi - Wiki example [message #162680] Thu, 01 July 2010 06:20 Go to previous message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma:
Senior Member
There is an example in the FUDapi that looks like this:
<?php
 include_once 'GLOBALS.php';
 include_once 'fudapi.inc.php';
 $topics = _fud_msg_multi(1, "SELECT root_msg_id FROM ".$GLOBALS['DBHOST_TBL_PREFIX']."thread WHERE forum_id={ARG} ORDER BY id DESC LIMIT 10");
 arsort($topics);
 foreach($topics as $topic) {
 	echo "POSTER: ". $topic->login ."\n";
 	echo "SUBJECT: ". $topic->subject ."\n";
 	echo "BODY: ". $topic->body ."\n\n";
 }
 ?>


However, when it returns only 1 result, it will break because of this:
	} else {
		if (count($result) == 1) {
			return array_pop($result);
		} else {
			return $result;
		}
	}
}

What is served as an array with 2 or more results, becomes a string, or something - When you print_r it, it doesnt show the usual array keys like key => value, it just lists values.

I get an MYSQL error when mine only could only return 1 result, so I commented out that part, mostly.


[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: File attachments stops working
Next Topic: forum datadump stopped working
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 21 18:31:12 GMT 2024

Total time taken to generate the page: 0.04930 seconds