Re[2]: [PHP-DB] Retruning an array from a row

From: Date: Wed, 30 Oct 2002 14:28:11 +0000
Subject: Re[2]: [PHP-DB] Retruning an array from a row
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-22821@lists.php.net to get a copy of this message
Hello John, Thanks, I've modified my code, and the solution is very simple function get_dbfield_data(){ $conn=dbconn(); // mysql connection function $result=mysql_query("SELECT Field1,Field2 FROM table_name WHERE Condition); $row=mysql_fetch_array($result); return $row; } // End function //... Now the main program $data=get_dbfield_data(); echo "Data Field : ".$data[0].", ".$data[1].""; } The Output: Data Field : Data1, Data2 Thanks for inspiring reply John... :) Best regards, Erick Wellem Wednesday, October 30, 2002, 7:53:30 PM, you wrote: 1JWH> You're only returning the first column of each row. If you just want to 1JWH> return the first row in the result, then do this: 1JWH> $result = mysql_query(...) 1JWH> $row = mysql_fetch_row($result) 1JWH> return $row; 1JWH> ---John Holmes...

« previous php.db (#22821) next »