6 Replies Latest reply on Sep 14, 2007 11:16 PM by (peter_harmsen)

    Strange behaviour of SQL

      I have made a trigger: <br /> <br />function Trigger_Custom(&amp;$tNG) { <br /> $klas_field = $tNG-&gt;getColumnValue('klas'); <br /> $date_field = $tNG-&gt;getColumnValue('datum'); <br /> $soort_toets_field = $tNG-&gt;getColumnValue('soort_toets'); <br /> $sql = "SELECT * FROM toetsen WHERE klas='".$klas_field."' AND '".$soort_toets_field."'='4' AND datum='".$date_field."'"; <br /> $result = $tNG-&gt;connection-&gt;execute($sql) or die(mysql_error()); <br /> if ($result-&gt;RecordCount() &gt; 0) { <br /> $errObj=new tNG_error("Deze klas heeft al een 4-toets op deze datum", array(),array()); <br /> return $errObj; <br /> }else{ <br /> return null; <br /> <br />In the database (MySQL) there are three fields important: klas, datum and soort_toets <br /> <br />In the database there are this records: <br /> <br />klas=b1a, soort_toets=2, datum=2007-09-17 <br />klas=b1a, soort_toets=2, datum=2007-09-17 <br /> <br />By inserting the next record: <br />klas=b1a, soort_toets=4,datum=2007-09-17 <br /> <br />the error message of the trigger is displayed! <br />I do not understand why! <br /> <br />DreamweaverCS3 with Developer Toolbox <br /> <br />Thanks a lot! <br /> <br />Peter <br /> <br />page is form.php <br />the listing: <br /><?php require_once('Connections/toetsen.php'); ?> <br /><?php<br />//MX Widgets3 include<br />require_once('includes/wdg/WDG.php');<br />?> <br /><?php require_once('Connections/gebruikers.php'); ?> <br />