|
-
Aug 18th, 2009, 12:20 PM
#1
Thread Starter
Member
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.
-
Aug 18th, 2009, 03:27 PM
#2
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);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|