need help coding simple serial number check

i've just learned php a few days ago and have tried to implement it in my website. Unfortunately i'm not very good at it because i dont have any programming back ground whatsoever. I was wondering if you guys can help me.

I am trying to make my webpage check to see if a value exists on a database table i have set up. It is basically a serial number check for one of our products. the code i have is attached bellow that i have tried to create by looking at different posts online.

If the value exists in the table, i want it to say that the value exists, and if it doesn't i want it to say that the value does not exist. really simple, but frustrating at the same time. Please help!! here is what i have below:


<?php require_once('Connections/myquery.php'); ?>
<?php // does user exist?
mysql_select_db($database_myquery, $myquery);
$Serial = GetSQLValueString($_POST['serial2'],"text";
$query = "SELECT serial_no FROM serialquery WHERE serial_no=%s;";
$res = mysql_query($query);
if (mysql_num_rows($res) > 0) {
// yes, pull in the user details
echo 'Congratulations. That serial is real';
} else
// no, user doesn't exist
echo 'Sorry! That serial doesn't exist'
}
?>
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories