Whith help from a Question I ask for some Minutes I get from this code:
$uid = $_SESSION['uid'];
$sth = $db->prepare("SELECT groupid FROM user_groups WHERE userid=?");
$sth->execute(array($uid));
$sth->execute();
$results = $sth->fetchAll(PDO::FETCH_COLUMN, 0);
$results = implode(",",$resultas);
echo $results;
A Output like this: 11,13. Thanks for your Help:)
Now I want to use this variable in another pdo-Query and I try this:
$stmt = $db->query('SELECT * FROM menu WHERE gruppe=0 OR gruppe in (?'
. ') ORDER BY reihe, parentId, name ');
$stmt->execute(array($results));
But there is no result... but wehen I try this
$stmt = $db->query('SELECT * FROM menu WHERE gruppe=0 OR gruppe in (11,13'
. ') ORDER BY reihe, parentId, name ');
$stmt->execute();
Isn't this the same? Can you pleas give me another hint for this?