how to placed the query results to an associative array?
I want to have a page with next and previous link as well as the pagination of the pages like 1 2 3 4. How do i placed the results of the query to an array without appending a LIMIT statement to the SQL. What i mean is another method that uses array to display records with pagination. My sql query is so complex that it needs to store the ids to an array. thanks.
Re: how to placed the query results to an associative array?
I don't think that your SQL is so complex that it would need to store all of the results in an array. that would be slow and inefficient, anyway; if you happen to have a large database, this will take forever.
post your code instead!
however, if you really want what you were asking for:
PHP Code:
$myarray = array();
$query = mysql_query($sql);
while($array = mysql_fetch_assoc($query)){
$myarray[$array['id']] = $array;
}
print_r($myarray);