is the following, so doing a query in the database with php! The code I use is the following:
<?php
$rs = $pdo->query(" SELECT * FROM licitacoes WHERE ID_USER = '$IDLOGADO' ")->fetchAll();
if(!$rs){ print_r($pdo->errorInfo()); }foreach ($rs as $row){
echo $row['ID_LICITI'] ;}
?>
The result of this query is: 2 | 0
I want to then transform this resulting into a variable so that I can use it in another query! Something like that
<?php
$rs = $pdo->query(" SELECT * FROM outratabela WHERE ID_LICITI = $resultado or ID_LICITI = $resultado")->fetchAll();
if(!$rs){ print_r($pdo->errorInfo()); }foreach ($rs as $row){
echo $row['ID_LICITI'] ;}
?>
How can I notice that I want to create a Where
in the first $ result and if I have more than one result I want to add the OR
according to the results.
I want to do this because the results of the first query are parameters to filter the results of the second query, but this "filter" will be given by the same amount of results from the previous query, which will be a maximum of 9 results.
Of course this was the way I thought (and it's not working very well, because I do not know how to do it, I'm lost here), but if I do it differently (a more facial)