PDO loop problem
Posted: Mon Jun 23, 2014 3:06 am
Can someone please tell me what's wrong with this:
When I run the procedure in phpmyadmin it returns one row with 4 columns (it could return more rows), but hidden never gets incremented. I tried with fetch instead of fetchall but that didn't work either.
The only reason I am doing this is because rowCount() doesn't work as it's a mysql select.
Code: Select all
$rdb = new PDO("$dbtype:host=$dbhost;dbname=$dbrecipes", $dbuser, $dbpass);
$sql="call query_recipes_with_name_id_owner_visible()";
$dbhidden = $rdb->prepare($sql);
$dbhidden->execute();
$hidden=0;
while($dbhidden->fetchAll()) {
$hidden++;
}
The only reason I am doing this is because rowCount() doesn't work as it's a mysql select.