while X array. It will BE one BUG????
| From: | Lauro Cesar | Date: | Wed, 09 Aug 2000 06:57:40 +0000 |
| Subject: | while X array. It will BE one BUG???? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-1882@lists.php.net to get a copy of this message | ||
Hello. My name is Lauro.
I am with a problem .. hehehe :)
See my script :
I select the code in the table agreement purchases as id_do user. .
======>
$seleciona = pg_exec($login, "select produto_id from compras where
id_usuario='$CLIENTE'");
if(!$seleciona){erro();}
$linhas_=(pg_numrows($seleciona)-1);
/*create an array with the values of $seleciona */
$dados=pg_fetch_array($seleciona, $n);
/* loop to read the array $dados */
while (list($linhas_)= each($dados))
{
/* to print for checking :)*/
print "$dados[$linhas_]\n";
/*
whel..
I select then in another table values of a registration (still inside of the loop) that correspond
to $dados[$linhas_].
*/
$seleciona_2 = pg_exec($login, "select * from estoque where
codigo='$dados[$linhas_]'");
if(!$seleciona_2){erro();}
/* how many lines verifying found in the table. *\
$linhas_2=(pg_numrows($seleciona_2));
/*printing it resulted of the verification of lines */
print "<hr>$linhas_2<hr>\n";
/* liberating the memory of the second query */
pg_freeresult($seleciona_2);
}
<<============
:(...
The problem is that my query doesn't recognize the variable $dados[$linhas_]
Substituting the variable for the name of a true code. . the query works
But $dados[$linhas_] it prints the name of a true code.
Question :
because it is not being printed inside of the query or is it been because the query doesn't
recognize? ?
I am using php4. . I needed the sessions. . in the 3 that worked...
He would like codes to make the same thing. .
To select a field of a table and with that result to select fields in other tables. .
thank you..
for all.. :)