Skip to content

Instantly share code, notes, and snippets.

@LayneSmith
Created June 18, 2015 13:39
Show Gist options
  • Select an option

  • Save LayneSmith/a08f12ba953d94db7b3b to your computer and use it in GitHub Desktop.

Select an option

Save LayneSmith/a08f12ba953d94db7b3b to your computer and use it in GitHub Desktop.
Check SQL in PHP
$sql = "SELECT COUNT(*) FROM " . $thisTable . " WHERE ip = '$ip'";
echo $sql;
$res = $db->query($sql);
if (! $res) {
print_r($db->errorInfo());
}
$duplicateIP = $res->fetchColumn();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment