Skip to content

Instantly share code, notes, and snippets.

@d30jeff
Created May 24, 2015 11:00
Show Gist options
  • Select an option

  • Save d30jeff/89b4b006f6a6c8c39f8d to your computer and use it in GitHub Desktop.

Select an option

Save d30jeff/89b4b006f6a6c8c39f8d to your computer and use it in GitHub Desktop.
b
<?php
function validation(){
$dbServer = 'localhost';
$dbUserName = 'root';
$dbPassword = '';
$dbName = 'DBeoi';
if (isset($_POST['eoinumber'],$_POST['lastcheck'])){
$eoinumber = $_POST['eoinumber'];
$lastname = $_POST['lastcheck'];
$dbConx = new mysqli($dbServer, $dbUserName, $dbPassword, $dbName);
$eoinumber = $dbConx->real_escape_string($eoinumber);
$lastname = $dbConx->real_escape_string($lastname);
if (!$dbConx){
echo '<p>Unable to connection to database. </p>';
} else {
$sql = "SELECT id FROM eoi WHERE id='$eoinumber'";
$query = $dbConx->query($sql);
if ($query->num_rows){
echo 'exists';
} else {
echo 'ok';
}
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment