Returning results

From: Date: Wed, 20 Oct 2010 23:59:00 +0000
Subject: Returning results
Groups: php.general 
Request: Send a blank email to php-general+get-308896@lists.php.net to get a copy of this message
Hi everyone, it's me again :-/ I'm having a whole lot of trouble figuring out how to return a result from a query such as in this code example: function LearnIt(){ $query = "SELECT learn_id FROM mydatabase "; $result = mysql_query($query); return $result; } I already achieved a connection to the database with no problem, to verify I wrote this query also: function GetMeARow(){ $query = "SELECT learn_id FROM mydatabase "; $result = mysql_query($query); while($row = mysql_fetch_array($result)){ echo $row[learn_id]; } With the latter, It works as expected, echoing the 2 rows I have in the DB, but I'm trying to understand the method used in the former. -- Blessings David M.

« previous php.general (#308896) next »