Admin page database query question
I'm trying to create an admin page based on the vb system of coding. The page is for an episode guide that I have that uses the template system and what not. I have it all set up but can't get it to insert the info into the database. Can someone look at my code and see if they can find what's wrong? The error is occuring when I run the script, not try to create the tables, I just put that datbase info there just in case.
PHP Code:
<?php
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// ##################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
// #################### PRE-CACHE TEMPLATES AND DATA ######################
$phrasegroups = array();
$specialtemplates = array();
if (!defined('SCRIPT_EXTENSION')) {
// vbiconfig.php couldn't be found, assume .php extension
define('SCRIPT_EXTENSION', '.php');
}
require_once('./global'.SCRIPT_EXTENSION);
// ############################# LOG ACTION ###############################
log_admin_action();
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
print_cp_header('Smallville Episode Guide');
if (empty($_REQUEST['do'])) {
$_REQUEST['do'] = 'add';
}
// ###################### Start edit #######################
if ($_REQUEST['do'] == 'add') {
print_form_header('smallville_episodeguide', 'insert');
print_table_header('Add Episode');
print_input_row('ID<br /><font size=1>For the id insert the number used for the episode. ex: The Pilot episode is episode 101.</font>', 'id');
print_input_row('Title', 'title');
print_textarea_row('Episode Description', 'description');
print_textarea_row('Episode Name Explanation', 'name_explanation');
print_input_row('Original Air Date', 'airdate');
print_input_row('Episode Image<br /><font size=1>Upload an image into the folder "nextonsmallville" which is found in the images folder. Insert the name and file type into this field. ex: crusade.gif</font>', 'image');
print_textarea_row('Guest Stars', 'guest_stars');
print_textarea_row('Episode Music', 'music');
print_textarea_row('Episode Quotes', 'quotes');
print_textarea_row('Epsiode Notes', 'notes');
print_textarea_row('Episode Bloopers', 'bloopers');
print_textarea_row('Written By', 'written_by');
print_textarea_row('Directed By', 'directed_by');
print_table_break();
// save options row
print_submit_row($vbphrase['save']);
}
// ###################### Start insert #######################
if ($_POST['do'] == 'insert') {
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "blah VALUES
($id, $title, $airdate, $name_explanation, $description, $guest_stars, $music, $quotes, $notes, $bloopers, $image, $written_by, $directed_by)
");
define('CP_REDIRECT', 'smallville_episodeguide'.SCRIPT_EXTENSION.'?do=add');
print_stop_message('episode_saved');
}
print_cp_footer();
?>
Database Info
Code:
CREATE TABLE `blah` (
`id` VARCHAR( 10 ) NOT NULL ,
`title` VARCHAR( 50 ) NOT NULL ,
`description` LONGTEXT NOT NULL ,
`image` VARCHAR( 100 ) NOT NULL ,
`directed_by` VARCHAR( 100 ) NOT NULL ,
`written_by` VARCHAR( 100 ) NOT NULL ,
`name_explanation` LONGTEXT NOT NULL ,
`airdate` VARCHAR( 50 ) NOT NULL ,
`music` MEDIUMTEXT NOT NULL ,
`guest_stars` MEDIUMTEXT NOT NULL ,
`quotes` LONGTEXT NOT NULL ,
`notes` LONGTEXT NOT NULL ,
`bloopers` LONGTEXT NOT NULL ,
PRIMARY KEY ( `id` )
);
This is the error
Quote:
Invalid SQL: INSERT INTO blah VALUES
(, , , , , , , , , , , , )
mysql 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 ' , , , , , , , , , , , )' at line 2
mysql error number: 1064
|
|