Hey guys,
I need some help with my php script. Actually my problem is, i have create a login that directs users to their profile page where they can see their data, in the user profile they can edit/delete and add a row to his data. Everything is working well but my add script is not working. everything you click add would add the new entry but create a id 0 (i have 2 tables user id and account) where in the user table id is primary key in each user is assign a int but no zero, example i log in with [email protected] (user id 3) log in -> home page add a row (would work but in my database table create (userd id 0) that info that i add would go to this user, would i like to get if a user id 3 add a row should this play the row right back to user. I know this is a silly problem or maybe my query its wrong PLEASE HELP
[php]
Add a New Reminder
<?php // if there are any errors, display them if ($error != '') { echo 'Title: *
Note: *
Date & Time: *
Alarm Type: *
Repeat: *
* required
if ($title == ‘’ || $note == ‘’ || $date_time ==’’ || $alarm_type ==’’ || $repeat_event ==’’)
{
// generate error message
$error = ‘ERROR: Please fill in all required fields!’;
// if either field is blank, display the form again
renderForm($id, $title, $note, $date_time, $alarm_type, $repeat_event, $error);
}
else
{
// save the data to the database
$result = $db->query(“INSERT INTO event (title, note, date_time, alarm_type, repeat_event) VALUES
(’”.$title."’,’".$note."’,’".$date_time."’,’".$alarm_type."’,’".$repeat_event."’)WHERE id =’".$id."’" )
or die(mysql_error());
$_SESSION[‘email’] = $email;
header(“Location: $email”);
exit();
}
}
else
// if the form hasn’t been submitted, display the form
{
renderForm(’’,’’,’’,’’,’’,’’,’’);
}}
?>
[/php]