Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-20-2004, 03:58 AM
Blue Moose Aaron's Avatar
Blue Moose Aaron Blue Moose Aaron is offline
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 12-20-2004, 12:48 PM
Blue Moose Aaron's Avatar
Blue Moose Aaron Blue Moose Aaron is offline
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry about putting it inthe wrong forum! I actually got it to work last night!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:07 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03576 seconds
  • Memory Usage 2,195KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete