Function Verifies Particular Record Exists

function vehicleIsInTable() {
/* Indicates whether the vehicle whose tag and state are
available in the global $tag and $state are found in the
table. */

  global $tag, $state;
  
  $query = "SELECT id
            FROM vehicles
            WHERE tag = '$tag' AND state = '$state'";
  $result = mysql_query($query);
  
  if (!$result) {
    die('Query failed. Err: 880037. -Programmer.');
  }

  if ( mysql_num_rows($result) < 1) {
    return false;
  } else {
    return true;
  }
}
Advertisements

About samehramzylabib

See About on https://samehramzylabib.wordpress.com
This entry was posted in Coding, Database and tagged , , , . Bookmark the permalink.

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s