J
|
Jane 4/16/2007 |
Hi, function BeforeAdd(&$values) { global $conn; $strSQLExists = "select * from classprog where time='".$values["time"]."' and subject='".$values["subject"]."' and room='".$values["room"]."'"; $rsExists = db_query($strSQLExists,$conn); $data=db_fetch_array($rsExists); if($data) { echo "Duplicate Entries, Try Again"; return false; } else { return true; } } |
Z
|
zebex author 4/16/2007 |
<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=16995&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' /> Thanks...worked flawlessly. Hi, entered values is stored in the $values array. Try to use following event code: |
L
|
larsonsc 4/16/2007 |
Try moving the final value for return outside of your loop. As you can see in one of my events below (this series manages adoptions of cats in the rescue group that I work with) in side each else or elseif, I set the return value, but then call the return value outside of the loop. Try doing something like that and see if that fixes your duplicate records issue. See the code below and feel free to contact me for further assistance if you need to. function BeforeAdd(&$values) |
J
|
Jane 4/17/2007 |
Hi, function BeforeAdd(&$values) { global $conn; $strSQLExists = "select * from classprog where time='".$values["time"]."' and subject='".$values["subject"]."' and room='".$values["room"]."'"; $rsExists = db_query($strSQLExists,$conn); $data=db_fetch_array($rsExists); if($data) { echo "<script>alert('Duplicate Entries, Try Again')</script>"; header("Location: classprog_list.php"); exit(); return false; } else { return true; } } |