tags:

views:

56

answers:

1
$result = mysql_query("SELECT * FROM project ORDER BY projectid");

while($row = mysql_fetch_array($result)) 
{
    return(array($row['projectid'],   $row['clientname'], 
                 $row['salesperson'], $row['prospect']));    
}

I get only the first set of values from the fields. I need all the values.

+5  A: 

You can only return once from a function. Build an array of results and return that:

$result = mysql_query("SELECT * FROM project ORDER BY projectid");
$values = array();
while($row = mysql_fetch_array($result)) 
{
    $values[] = array($row['projectid'], $row['clientname'], $row['salesperson'], $row['prospect']);
}

return $values;
Greg
I would suggest something like array_push($values, $row); to get all columns.
merkuro
Thanks for the Help