Jump to content

Recommended Posts

Here is the 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 'all,asia_pacific,EMEA,greater_china,latin_america,north_america,doc_type,title,a' at line 1

 

 

Here is the echo of where the error is:

INSERT INTO newsdocs (region,all,asia_pacific,EMEA,greater_china,latin_america,north_america,doc_type,title,abstract,author,page_content,file,url,source,date,creator) VALUES ('0','','1','','1','','','','Test','Testing','Test Man','gasdfadf','','Test','','2007-10-23','altagroup')

 

 

it was working before i added the all, asia_pacific, EMEA, greater_china, latin_america, north_america, but the thing is that those colmns are in the table. This makes no sence to me i am just trying to make it to where people can post news bulletons in more areas than one. The region column was the last one that i had but it only enabled for one region at a time. What is the best way or is this fixable? I am not to sure y it is not working. somone help heres the code for the insert

 

<?php
$db_to_form = array(
	"region" => "region",
	"all" => "all",		 
	"asia_pacific" => "asia_pacific",
	"EMEA" => "EMEA",
	"greater_china" => "greater_china",
	"latin_america" => "latin_america",
	"north_america" => "north_america",	 
	"doc_type" => "doc_type",
	"title" => "title",
	"abstract" => "abstract",
	"author" => "author",
	"page_content" => "page_content",
	"file" => "filename",
	"url" => "url",
	"source" => "source"//,
	//"date" => "date"
);
$ins_db_values .= "'". $_POST[$value]."',";

$create_this_sql = "INSERT INTO newsdocs  (".$db_to_form.") VALUES (".$ins_db_values.")";
?>

Link to comment
https://forums.phpfreaks.com/topic/74475-solved-why-am-i-getting-this-error/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.