On 2010-10-20, at 7:59 PM, David McGlone <david@xxxxxxxxxxxxx> wrote: > 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. > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php David, the $result variable/object is the handle to the result data set, not the resulting data. You would still need to access the data set via the Mysql_* set of functions like Mysql-fetch_array or Mysql_result like you did in the second example Bastien Koert > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php