This topic is locked
[SOLVED]

 Check If Specific Record Exists With Pop-Up

1/10/2013 4:19:35 AM
PHPRunner General questions
L
lkh11lkh author

hi

//** Check if specific record exists ****

global $conn;

$strSQLExists = "select * from data where Name='".$values["Name"]."' and Email='".$values["Email"]."' and Magazine='".$values["Magazine"]."'";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

if($data)

{

//echo "Duplicate Entries, Try Again";

$result['msg'] = "Record already exists";

return false;

}

else

{

return true;}


may i know where shd i place this code => alert(result['msg']);
please advise with thanks

C
cgphp 1/10/2013
//********** Check if specific record exists ************

global $conn;

$strSQLExists = "select * from data where Name='".$values["Name"]."' and Email='".$values["Email"]."' and Magazine='".$values["Magazine"]."'";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);
if($data)

{

echo '<script>alert("Record already exists");</script>';

return false;

}

else

{

return true;

}
L
lkh11lkh author 1/10/2013

hi cristian
thanks alot