Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

help : check if specific record exists

help : check if specific record exists



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);
// if the record exists
$message="<div class=message><<< "."Database NOT updated ......The name entered already exists.....Use another name"." >>></div>";
return false;

return true;

but with this code

$strSQLExists = "select * from siswa where nama='".$values["nama"]."' AND nis='".$values["nis"]."'";
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


1:03 pm on Sep 24, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

I don't understand what it is you're asking.


4:12 am on Sep 26, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Is there a record in siswa that has both the values for nama and nis?
Because that's what your query is looking for?
If you want to see if there is a record where it has either the value for name or the value for nis, you need to have an OR rather than an AND.

Featured Threads

Hot Threads This Week

Hot Threads This Month