TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 10-14-2005, 08:10 PM   #1 (permalink)
The Visitor
 
Join Date: Oct 2005
Posts: 2
Thanks: 0
NixMaster is on a distinguished road
Default SQL/Array question

I'm trying to create an array from a mysql query. For example

$query = mysql_query("SELECT id FROM users ORDER BY id DESC LIMIT 84");

now I need to create an array of the id's.

For example $id[0], $id[1] - $id[83].

Thanks.
NixMaster is offline  
Reply With Quote
Old 10-14-2005, 08:23 PM   #2 (permalink)
The Contributor
 
Join Date: Mar 2005
Posts: 81
Thanks: 0
AlEast is on a distinguished road
Default

Ok this is what I'm getting from your question. Let me know if I understood incorrectly.

You want an array with all the values to do something with later. You could create your array dynamically by using the mysql_fetch_array

Code:
$idArray = array();
while($row=mysql_fetch_row($result)){
    $idArray[] = $row[0];
}
__________________
NEWEDGE Services, Inc. - Developers of ClientExec
AlEast is offline  
Reply With Quote
Old 10-14-2005, 08:49 PM   #3 (permalink)
The Visitor
 
Join Date: Oct 2005
Posts: 2
Thanks: 0
NixMaster is on a distinguished road
Default

Thats great, thanks for the help.

1 problem. How can I read the database backwards? The graph's high point is left now and I want it on the right. If I do the query ASC it pulls old information instead of the new information, if I pull it DESC its the correct information but as I said above the graph is backwards.


Thanks again for the help.
NixMaster is offline  
Reply With Quote
Old 10-14-2005, 10:21 PM   #4 (permalink)
The Acquainted
 
Join Date: May 2005
Posts: 106
Thanks: 0
jaswinder_rana is on a distinguished road
Default

ASC or DESC are the only options, but to get your desired results you might need to make a complex query.
can you show by example, what you need and also give us table details.

certainly someone will be happy to help you.
__________________
---------------------------
Errors = Improved Programming.
Portfolio
Send a message via MSN to jaswinder_rana
jaswinder_rana is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about a test membership matthew Absolute Beginners 7 05-29-2005 01:18 AM


All times are GMT. The time now is 03:46 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design