For this query:
$sql='select col from table where other_col=?';
I am currently getting the returned data like so:
$data=$statement->fetch()['col'];
That doesn't look very good to me. Is there a better way of doing that or is that fine as it is?
You can try :
$data=$statement->fetchColumn(0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With