When given an ID
number, I want to check to see if it exists in the database. Return true
if the ID
is found and if not, then return false
.
My knowledge of MySQL is very low, but I am assuming it would be something to do with the COUNT(*)
function possibly?
select id from table where id = $id
No need to get fancy. Using exists with subqueries seems likely only to generate poor performance, but I'm happy to be corrected if shown otherwise.
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