arrays - how to return many values in mysql_fetch_array php -
i want first_name , last_name database.
select them, i'm unable return both space in-between them, , need returned not echoed because going use link user profile.
function getuser ($id, $field_one, $field_two) { $query = mysql_query("select $field_one, $field_two users user_id='$id'"); $run = mysql_fetch_array($query); return $run[$field_one, $field_two]; }
i think problem in last 2 lines
$run = mysql_fetch_array($query); return $run[$field_one];
try this:
return $run[$field_one] . " " . $run[$field_two];
btw have change query to:
"select {$field_one}, {$field_two} users user_id={$id}"
take @ examples: http://php.net/manual/en/function.mysql-fetch-array.php
Comments
Post a Comment