vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   PHP/mySQL Error (https://vborg.vbsupport.ru/showthread.php?t=110830)

DrewM 03-19-2006 09:53 PM

PHP/mySQL Error
 
Well I'm making a page that will add pages to my sit but when you post it says:
Quote:

Database error in vBulletin 3.5.4:
Invalid SQL:
INSERT INTO page
name='EPS',
edit_by='Rdsx',
status='1',
contents='OFB Info Movies Pictues';
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 'name='EPS',
edit_by='Rdsx',
status='1',
contents='OFB Info Mo' at line 2
Error Number : 1064
My php code is:
PHP Code:

<?php 
// ####################### SET PHP ENVIRONMENT ########################### 
error_reporting(E_ALL & ~E_NOTICE); 
// #################### DEFINE IMPORTANT CONSTANTS ####################### 
define('NO_REGISTER_GLOBALS'1); 
define('THIS_SCRIPT''Adminpages');
// ################### PRE-CACHE TEMPLATES AND DATA ######################
$phrasegroups = array();
$specialtemplates = array();
// pre-cache templates used by all actions 
$globaltemplates = array( 
     
'site_admin_add',
);
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################ 
 
chdir('/home/rdsx667/public_html/forum/'); 
require_once(
'./global.php'); 
// ####################################################################### 
// ######################## START MAIN SCRIPT ############################ 
// #######################################################################
$navbits = array(); 
$navbits[$parent] = admin
$navbits construct_navbits($navbits); 
eval(
'$navbar = "' fetch_template('navbar') . '";');
 
// ################ SHOW NO PERMISSION PAGE TO GUESTS ####################
if (!is_member_of($vbulletin->userinfo11) AND !is_member_of($vbulletin->userinfo6)) 

        
print_no_permission(); 
}  
// ########################### ADD THE SITE ##############################
if ($_REQUEST['do'] == "add")
{
eval(
'print_output("' fetch_template('site_admin_add') . '");');
}
if (
$_REQUEST['save'] == "add")
{
//------------------------------------------------------------
// Add the site to the database if everything is ok.
//------------------------------------------------------------
 // Sanitize User Submitted Data
 
$vbulletin->input->clean_array_gpc('p', array(
 
'name' => TYPE_STR,
 
'description' => TYPE_STR
 
));
     
$sql "INSERT INTO " TABLE_PREFIX "page
      name='"
.$db->escape_string($vbulletin->GPC['name'])."',
      edit_by='"
.$db->escape_string($vbulletin->userinfo['username'])."', 
      status='1',
      contents='"
.$db->escape_string($vbulletin->GPC['description'])."'";
    
$db->query_write($sql);

?>


Xenon 03-20-2006 08:43 PM

it's an invalid insert statement ;)


PHP Code:

$sql "INSERT INTO " TABLE_PREFIX "page
      (name, edit_by_status, contents) VALUES ('"
.$db->escape_string($vbulletin->GPC['name'])."','".$db->escape_string($vbulletin->userinfo['username'])."','1','".$db->escape_string($vbulletin->GPC['description'])."')"


DrewM 03-20-2006 08:53 PM

thanks!!!


All times are GMT. The time now is 04:34 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01579 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete