homepage Welcome to WebmasterWorld Guest from 54.211.73.232
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
How can I determine if a record exists?
sakala



 
Msg#: 4496987 posted 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

 

coopster

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



 
Msg#: 4496987 posted 9:23 pm on Jan 20, 2013 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved