mysql - Checking database for duplicate values, no error -
hi hoping @ section of code see if can find mistakes can't seem figure out, section of code is;
//check if "date" textbox has value if ((isset($_post['date'])) && (isset($_post['save']))) { //check if there entry date $query = "select date `".$username."weight` date= " . $_post['date']; $existingdate = mysql_query($query) or trigger_error(mysql_error().$query); $results = mysql_num_rows($existingdate); if($results > 0) { $exists = "there entry date. add entry please select date 'weight history' section , click 'edit'"; } else { $date = $date; } }
the situation is; - user enters date, weight , have option of entering notes. - when log in user , enter information, enters database fine. - but, when user goes enter entry, want first check havent made entry day. therefore, above code checks if table contains entry specified date.
i not receiving errors, form keeps entering values, regardless of whether there entry date.
i appreciate thanks.
Comments
Post a Comment