Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

passing mysql_fetch_array to array()

Tags:

php

how can i pass mysql_fetch_array() to array()

like image 838
Web Worm Avatar asked Nov 28 '22 23:11

Web Worm


2 Answers

If you want to use it for multiple results you may want to assign within the while statement. Such as

$query = mysql_query("SELECT * FROM users");
$resultSet = array();
while($result = mysql_fetch_array($query))
{
    $resultSet[] = $result;
}
like image 125
ahmetunal Avatar answered Dec 08 '22 00:12

ahmetunal


did you mean:

$variable = mysql_fetch_array($result); //$variable is now an array
like image 41
erenon Avatar answered Dec 08 '22 00:12

erenon