Re[2]: Retruning an array from a row

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

 



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...



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux