I am performing a query in the database and want to return more than one query value how do I do this?
The structure of my table and the following
Id_idx | name | OUTROS |
Each Id_idx can be repeated up to 3 times I want to count how many rows are returned which is the first part of code and also returns the values of the other columns.
Here it will only return the number of rows.
$char = $pdoG->prepare("SELECT * FROM u_hero WHERE id_idx = :id");
$char->bindValue(":id",$id);
$char->execute();
$chars = $char->rowCount();
return $chars;
While here, the information is returned to me.
$char = $pdoG->prepare("SELECT * FROM u_hero WHERE id_idx = :id");
$char->bindValue(":id",$id);
$char->execute();
$chars = $char->fetchAll(PDO::FETCH_OBJ);
return $chars;
How do I merge these return
into a single static function
?