0
is the following, to make 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 consultation is: 2 | 0
I want to turn that resulting into a variable so I can use it in another query! Something like this
<?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'] ;}
?>
As you can see I want you to create a Where
in the first $result and in case there is 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 of the previous query, which will be at most 9 results.
Of course that was the way I thought (and it’s not working out very well, because I don’t know how to do it, I’m lost here), however if how to do otherwise (a more facial) I thank you
failed to concatenate the string -> $sql .= 'IN(
– Adir Kuhn
@Adirkuhn, thank you really missed the point hehe :)
– rray