Returning results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux