Page 1 of 1

Stupid question about queries

Posted: Sat Sep 07, 2002 5:28 am
by Coco
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?

Posted: Sat Sep 07, 2002 7:58 am
by sjunghare
Do you want to do recurssion work by firing query inside other ?

Posted: Sat Sep 07, 2002 8:24 am
by Coco
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

Posted: Mon Sep 09, 2002 6:08 am
by Coco
no matter i managed to work it out myself...
the beginner learns more :D

Posted: Mon Sep 09, 2002 7:24 am
by m3mn0n
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'");
?>