Jump to content

Opinion on database search..


Scooby08

Recommended Posts

I'm just looking for an opinion on a recommended way to search a database for a specific value..

 

Would it be one of the following or perhaps there is a better approach??

 

<?php
$count = mysql_result(mysql_query("SELECT count(*) FROM bank_routing_numbers WHERE blacklist='091000019'"),0);
if ($count > 0) {
// exists
} else {
// doesnt exist
}
?>

 

or

 

<?php 
$num_rows = mysql_num_rows(mysql_query("SELECT blacklist FROM bank_routing_numbers WHERE blacklist='091000019'"));
if ($num_rows > 0) {
// exists
} else {
// doesnt exist
}
?>

Link to comment
https://forums.phpfreaks.com/topic/263777-opinion-on-database-search/
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.