Welcome to WebmasterWorld Guest from 23.20.241.155

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)



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)

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



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

Featured Threads

Hot Threads This Week

Hot Threads This Month