What I'm trying to do is make a small basic control panel that only I will have access to. I've got the html done, but now I'm doing the PHP. I'm trying to keep the php code very basic so it will be at my level of knowledge. Roadblock though. I've managed to get my first control panel form to access my database(MySQL), I'm very sure of this as at the bottom of the form, I've programmed it to list all items already in my "news" table of my database. The problem is however, something seems to be wrong with my insert statement for the form... it's hitting a brickwall somewhere and every website just tells me to do it the way I already am. Enough with trying to describe my perdicament, here comes the facts.
The table I'm using is called "news" - it has a total of 8 fields; id, type, title, month, day, year, body, and by.
The code I'm using to insert is such -
<?php include "db.php"; $type = $_POST['type']; $title = $_POST['title']; $month = $_POST['month']; $day = $_POST['day']; $year = $_POST['year']; $body = $_POST['body']; $by = $_POST['by']; mysql_query("insert into news(type, title, month, day, year, body, by) values('$type', '$title', '$month', '$day', '$year', '$body', '$by')") or die("Insert error : ". mysql_error()); ?>
The error I'm receiving says -
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Insert error : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'by) values('news', 'testing', '03', '09', '06', 'testing', 'riy[/quote]
My host is avahost, not sure if that helps....
If you need more information from me, please poke me and let me know. Any and all help is vital and greatly appreciated.
EDIT - Updated code and quote, thank you for the fast help. It's still being stubborn though ^^"