Im trying to check my database to seee if a EHPID exsists and if it does let the user register, if it dosent exsist i need a message box.
heres the code im trying to put in
$query1 = "SELECT * FROM mem WHERE ehpid = $EHPID":
$result = mysql_query($query2) or exit(mysql_error());
if (mysql_num_rows($result) {
else {
// what to do if ehpid not found
echo '<script language = "javascript">
alert("Your records are not in our system yet. Please Try Again at another time")
</script>';
print '<meta http-equiv="refresh" content="0;URL=register2.html">';
heres original code
<?php
$user = $HTTP_POST_VARS['username'];
$pass = $HTTP_POST_VARS['pass'];
$Last = $HTTP_POST_VARS['T3'];
$First = $HTTP_POST_VARS['T1'];
$Email = $HTTP_POST_VARS['T4'];
$EHPID = $HTTP_POST_VARS['T2'];
$mysql = mysql_connect('localhost', 'e9999', '9999') or exit(mysql_error());
mysql_select_db('e99999n') or exit(mysql_error());
// check EHPID here
$query1 = "SELECT * FROM mem WHERE ehpid = $EHPID":
$result = mysql_query($query2) or exit(mysql_error());
if (mysql_num_rows($result) {
//ehpid exists so continue
$query2 = "SELECT from test WHERE name = '$user'";
$result = mysql_query($query2) or exit(mysql_error());
if (mysql_num_rows($result))
{
echo '
<script language = "javascript">
alert("You have entered a taken username. Please try another username");
</script>
<meta http-equiv="refresh" content="0;URL=register2.html">
';
}
else
{
$query = "INSERT INTO test VALUES ('$user','$pass','$Last','$First','$Email','$EHPID
')";
$result = mysql_query($query) or exit(mysql_error());
echo '
Registeration Successful<br>
Click here to Login to the Online Customer Service System <a href ="main4.html">Login</a><br>
';
}
// end of ehpid found
}
else {
// what to do if ehpid not found
echo '<script language = "javascript">
alert("Your records are not in our system yet. Please Try Again at another time")
</script>';
print '<meta http-equiv="refresh" content="0;URL=register2.html">';
}
?>