-2
$rs = $pbc->selectPublication(filter_input(INPUT_GET, 'id', FILTER_DEFAULT));
I have this code that is passed as argument of the method to select the posts on the system, but how can I use it with ternary, if it returns true and is filtered smoothly pass the value, or if any problem, send 0?
My select class:
$selectSQL = $this->pdo->prepare('SELECT values WHERE id = ? LIMIT 1');
$selectSQL->bindValue(1, $codigo, PDO::PARAM_INT);
$selectSQL->execute();
$row = $selectSQL->fetch(PDO::FETCH_ASSOC);
return $row;
What is his return, in case of error?
– Felipe Avelar
0, or if there is a problem, send 0.
– user92889
If his return, when he makes a mistake, is already zero, why do you need a ternary?
– Felipe Avelar
I didn’t know that returns 0
– user92889
Ah, I thought you said zero.
– Felipe Avelar
But there’s a way you can stick the method
selectPublication
to facilitate the response?– Felipe Avelar