Hello, welcome to the forums.
Let's see if I can answer this good for you.
Whenever you try to execute an sql INSERT statement without defining the fields and are ONLY defining the values, that means that you are supplying to MySQL ALL VALUES for ALL fields. I don't think that is the case in this sql statement:
Code: Select all
$sql = "INSERT INTO albums VALUES( '" . addslashes($_POST['album_name']) . "', '" . addslashes($_POST['album_desc']) . "', 0, '', '')";
This sql statement suggests that there are only 5 fields. If you go into your table, check to make sure this matches.
I'm willing to bet that you are leaving out the auto increment field. If this is the case, you will need to change your sql statement to specify which fields are to be used with each values. Note that your fields MUST match the SAME order as your values...
example:
Code: Select all
$sql = "INSERT INTO albums (`album_name`, `album_desc`, `show_album`, `edited_by`, `date_ended`) VALUES( '" . addslashes($_POST['album_name']) . "', '" . addslashes($_POST['album_desc']) . "', 0, '', '')";
Of course, your fieldnames will be different, so substitute where needed. hope this helps.