Page is a not externally linkable
- Code, Content, and Presentation
-- Databases
---- help : check if specific record exists


sakala - 9:41 pm on Sep 19, 2012 (gmt 0)


This is my code "Check If Specific Record Exist" with 1 values and everything goes fine

global $conn;
$strSQLExists = "select * from siswa where nama='".$values["nama"]."'";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
if($data)
{
// if the record exists
$message="<div class=message><<< "."Database NOT updated ......The name entered already exists.....Use another name"." >>></div>";
return false;
}
else
{


return true;
}

but with this code

$strSQLExists = "select * from siswa where nama='".$values["nama"]."' AND nis='".$values["nis"]."'";
or
select * from kelas where nama='$values['nama']' AND nis='$values['nis']'


The $values["nis"] still record after added

Please help me, how to avoid record exist for nama and nis values.

Thank you so much


Thread source:: http://www.webmasterworld.com/databases_sql_mysql/4497516.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com