Reply
Old 04-26-2008, 08:19 PM Queries on results
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
How could I perform queries using data from a previous query?
I want this because i have a category table and a subcategory table
and for every category it performs a query on the subcategory table.

Do you know what I mean? If not I can edit the topic for clarity.
__________________
My webmaster news & tips blogs with free scripts and tutorials - http://ap-gfx.com
andyp is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 04-27-2008, 03:59 AM Re: Queries on results
solomongaby's Avatar
Webmaster Talker

Latest Blog Post:
How Do You Find Music Online ?
Posts: 522
Name: Gabe Solomon
Location: Romania
Trades: 1
can you post the tables basic structure and what exacly you want to do ?
__________________
If you like my posts ... TK is appreciated:)
Web Directory | Blog
solomongaby is offline
Reply With Quote
View Public Profile Visit solomongaby's homepage!
 
Old 04-27-2008, 02:39 PM Re: Queries on results
Extreme Talker

Posts: 158
Trades: 0
first query:
PHP Code:
$_SESSION['qry1'] = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE Username = 'Bob'")); 
The session variable should have all the info about bob that you could use for a second query, like $_SESSION['qry1']['firstName']. But if the second query or even the first query is going to be returning multiple rows of data, you would have to do:

PHP Code:
 while($row mysql_fetch_assoc($qry))

second query

Hopefully this helps, but if you have any questions, just ask.
kbfirebreather is offline
Reply With Quote
View Public Profile
 
Old 04-27-2008, 03:53 PM Re: Queries on results
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
Sorry never realised i forgot to give the code.
PHP Code:
while($post mysql_fetch_array(mysql_query("select * from posts where topic='$id'")))
{
    echo(
$post['body']);
    echo(
$post['userid']);
    echo(
$post['date']);
    echo(
"<br/>");

__________________
My webmaster news & tips blogs with free scripts and tutorials - http://ap-gfx.com
andyp is offline
Reply With Quote
View Public Profile
 
Old 04-27-2008, 04:05 PM Re: Queries on results
Extreme Talker

Posts: 158
Trades: 0
I think that's for the other thread, no?
kbfirebreather is offline
Reply With Quote
View Public Profile
 
Old 04-27-2008, 07:39 PM Re: Queries on results
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
Sorry, about that, guess i posted the wrong code here. I'll need to try your ideas out, and the one that got it right, well I'll give you some talkupation
__________________
My webmaster news & tips blogs with free scripts and tutorials - http://ap-gfx.com
andyp is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Queries on results
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.13687 seconds with 13 queries