Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
Coco
Forum Contributor
Posts: 339 Joined: Sat Sep 07, 2002 5:28 am
Location: Leeds, UK
Contact:
Post
by Coco » Sat Sep 07, 2002 5:28 am
I read somewhere in here that php only allows one query for security...
question is if im doing this:
Code: Select all
<?php
while ($row = mysql_fetch_array($result))
?>
in my code, and i then need to do an query dependant on a variable returned in the above query can i do it? ie something like...
Code: Select all
<?php
while ($row = mysql_fetch_array($result)){
//Stuff
if ($rowї'thing'] = this){
$result2 = mysql_query("SELECT * FROM xxx WHERE xax = '$rowї'thing']'");
//more stuff
}
?>
if not suggestions?
sjunghare
Forum Newbie
Posts: 16 Joined: Tue Sep 03, 2002 6:22 am
Location: Pune
Post
by sjunghare » Sat Sep 07, 2002 7:58 am
Do you want to do recurssion work by firing query inside other ?
Coco
Forum Contributor
Posts: 339 Joined: Sat Sep 07, 2002 5:28 am
Location: Leeds, UK
Contact:
Post
by Coco » Sat Sep 07, 2002 8:24 am
I have a table field which has 0, 1 or more unique entries... so i cant easily put it straight into the field cos there is variable amounts of data items going in (or at least i probably can but im too newbie to do it.)
So i put in a 1 or a 0 and do a logic test, if 1 i need to call another table which contains this data
but cos im using fetch_array i cant kill the previous query else it loses its place in the table
Coco
Forum Contributor
Posts: 339 Joined: Sat Sep 07, 2002 5:28 am
Location: Leeds, UK
Contact:
Post
by Coco » Mon Sep 09, 2002 6:08 am
no matter i managed to work it out myself...
the beginner learns more
m3mn0n
PHP Evangelist
Posts: 3548 Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada
Post
by m3mn0n » Mon Sep 09, 2002 7:24 am
I beg to differ....
I always do multiple querys when i code. It's perfectly fine and i get no errors.
Just rename the query variables and you should be good to go.
eg.
Code: Select all
<?
$result = mysql_query("SELECT * FROM xxx WHERE xax = '$row'");
$result2 = mysql_query("SELECT * FROM xxx WHERE xax = '$row2'");
?>