错误....正确的语法在第1行附近使用')' [英] Error .... right syntax to use near ')' at line 1

查看:60
本文介绍了错误....正确的语法在第1行附近使用')'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个程序''My Contact Table''这是一个代码生成器程序。它允许您轻松创建PHP / MySQL Web应用程序而无需编写任何代码。

我正在尝试创建一个额外的数据输入页面。我复制了一个现有页面并在我的数据库中创建了一个新表。当我运行脚本时,我收到错误消息您的SQL语法中有错误;检查与MySQL服务器版本对应的手册,以便在第1行')''附近使用正确的语法。

你能告诉我应该在哪里寻找这个错误吗?

我将我的代码与原始代码进行了比较,无法看到此错误可能来自的任何地方。

这里是我脚本的第一部分.... [php]

<?php

需要''../mysqlvars.php'';

需要''../init.php'' ;

需要''../lib/db.php'';

需要''../lib/form_functions.php'';
< br $>
session_start(''MEMBERS'');


$ dbConn = connectDB($ dbHost,$ dbUser,$ dbPass,$ dbDB);

if(!$ dbConn){

die(''数据库目前已关闭...请稍后再试'')

}

需要''includes / secure_page.php'';

未设置($ error);

未设置($ confirm);

if(isset($ _ POST ['提交''])){

if(空($ _ POST [''last_name''])){

$ error =''你必须输入一个姓氏'';

}

if(!isset($ error)){

$ query =" INSERT INTO wsd_agent(agent_id,first_name ,last_name,add1,add2,town,coun ty,postcode,bac_ref,sage_ref,week,note,clock,home_ tel,mobile_tel)VALUES(" ;;

$ query。=''NULL' '。 ,;

$ dfield = prepareData($ _ POST [''week'']);

$ dfieldparts = explode(" /" ;, $ dfield);

if(count($ dfieldparts == 3)){

$ insdate = $ dfieldparts [2] .''-''。$ dfieldparts [0]。'' - ' '。$ dfieldparts [1];

$ query。="''$ insdate''," ;;

}

$ query。="''" 。 prepareData($ _ POST [''first_name''])。 "" 。 '','';

$ query。="''" 。 prepareData($ _ POST [''last_name''])。 "" 。 '','';

$ query。="''" 。 prepareData($ _ POST [''add1''])。 "" 。 '','';

$ query。="''" 。 prepareData($ _ POST [''add2''])。 "" 。 '','';

$ query。="''" 。 prepareData($ _ POST [''town''])。 "" 。 '','';

$ query。="''" 。 prepareData($ _ POST [''county''])。 "" 。 '','';

$ query。="''" 。 prepareData($ _ POST [''postcode''])。 "" 。 '','';

$ query。="''" 。 prepareData($ _ POST [''bac_ref''])。 "" 。 '','';

$ query。="''" 。 prepareData($ _ POST [''sage_ref''])。 "" 。 '','';

$ query。="''" 。 prepareData($ _ POST [''note''])。 "" 。 '','';

$ query。="''" 。 prepareData($ _ POST [''clock''])。 "" 。 '','';

$ query。="''" 。 prepareData($ _ POST [''home_tel''])。 "" 。 '','';

$ query。="''" 。 prepareData($ _ POST [''mobile_tel''])。 "" 。 '','';

$ query。=")" ;;

if(mysql_query($ query,$ dbConn)){?>

< SCRIPT LANGUAGE =" JavaScript"> [/ php]

我们将不胜感激任何帮助。

请阅读发布指南并将您的代码包含在appripriate代码标签中! - 主持人

解决方案

dbConn = connectDB(


dbHost,


DBUSER,

I am using a program ''My Contact Table'' which is a code generator program. It allows you to easily create a PHP/MySQL web application without writing any code.
I am trying to create an additional data entry page. I have copied an existing page and created a new table in my database. When I run the script I get the error message "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 1"
Can you tell me where I should be looking for this error?
I have compared my code with the original and cannot see anywhere where this error might come from.
Here''s the first part of my script....[php]
<?php
require ''../mysqlvars.php'';
require ''../init.php'';
require ''../lib/db.php'';
require ''../lib/form_functions.php'';

session_start(''MEMBERS'');

$dbConn = connectDB($dbHost, $dbUser, $dbPass, $dbDB);
if (!$dbConn) {
die(''Database is currently down...please try again later'');
}
require ''includes/secure_page.php'';
unset($error);
unset($confirm);
if (isset($_POST[''submit''])) {
if (empty($_POST[''last_name''])) {
$error = ''You must enter a last name'';
}
if (!isset($error)) {
$query = "INSERT INTO wsd_agent (agent_id,first_name,last_name,add1,add2,town,coun ty,postcode,bac_ref,sage_ref,week,note,clock,home_ tel,mobile_tel) VALUES (";
$query .= ''NULL'' . '','';
$dfield=prepareData($_POST[''week'']);
$dfieldparts=explode("/", $dfield);
if(count($dfieldparts==3)){
$insdate=$dfieldparts[2].''-''.$dfieldparts[0].''-''.$dfieldparts[1];
$query .= "''$insdate'',";
}
$query .= "''" . prepareData($_POST[''first_name'']) . "''" . '','';
$query .= "''" . prepareData($_POST[''last_name'']) . "''" . '','';
$query .= "''" . prepareData($_POST[''add1'']) . "''" . '','';
$query .= "''" . prepareData($_POST[''add2'']) . "''" . '','';
$query .= "''" . prepareData($_POST[''town'']) . "''" . '','';
$query .= "''" . prepareData($_POST[''county'']) . "''" . '','';
$query .= "''" . prepareData($_POST[''postcode'']) . "''" . '','';
$query .= "''" . prepareData($_POST[''bac_ref'']) . "''" . '','';
$query .= "''" . prepareData($_POST[''sage_ref'']) . "''" . '','';
$query .= "''" . prepareData($_POST[''note'']) . "''" . '','';
$query .= "''" . prepareData($_POST[''clock'']) . "''" . '','';
$query .= "''" . prepareData($_POST[''home_tel'']) . "''" . '','';
$query .= "''" . prepareData($_POST[''mobile_tel'']) . "''" . '','';
$query .= ")";
if (mysql_query($query,$dbConn)) { ?>
<SCRIPT LANGUAGE="JavaScript">[/php]
Any help would be appreciated.

Please read the Posting Guidelines and enclose your code within the appripriate code tags! - moderator

解决方案

dbConn = connectDB(


dbHost,


dbUser,


这篇关于错误....正确的语法在第1行附近使用')'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆