Welcome to WebmasterWorld Guest from 54.159.19.75

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

How can I determine if a record exists?

     
6:27 pm on Sep 18, 2012 (gmt 0)

New User

joined:Sept 18, 2012
posts: 2
votes: 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
9:23 pm on Jan 20, 2013 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12533
votes: 0


Cross-post, see [webmasterworld.com...]