How to detect conflicted id during registration?
Posted: Sun Jul 27, 2008 4:23 am
hey guys,
I need a code that could detect similar ID entered from registration, i've try this code that i made by myself but it doesnt work, help me dude...
the result always showing "registered" eventhough the entered id are conflicted...
Regards,
Azhan
_________________________
http://www.productcoverdesign.com-"Cheapest E-Cover Design"
I need a code that could detect similar ID entered from registration, i've try this code that i made by myself but it doesnt work, help me dude...
Code: Select all
<?php
mysql_connect("localhost", "root", "password") or die(mysql_error());
mysql_select_db("hospital") or die(mysql_error());
if (isset($_POST['submit'])) {
$take = @mysql_query("SELECT * FROM patientlist");
while($take2 = @mysql_fetch_array($take)){
if( $_REQUEST['id'] == $take['id']) {die('Conflicted ID entered');}
else { print ' registered ' ;}
exit;
}
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<tr><td>Patient's ID:</td><td>
<input type="INT" name="id" maxlength="50">
</td></tr>
<input type="submit" name="submit" value="ENTER">
Regards,
Azhan
_________________________
http://www.productcoverdesign.com-"Cheapest E-Cover Design"