sql syntax error

2014-08-08 Thread florent larose
hello, i am working on my personal website wih php 5.4.16 / mysql 5.6.12 (my 
system : windows 7 / wampserver 2).
i have a bug when i am running my connection to database webpage.
My error message is the following :
Erreur SQL : 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 ''membres2' WHERE
'pseudo_membre' = '\'Flarose59\'' GROUP BY 
'id_membre'' at line 1 
Ligne : 29.

this is my php code :
 $result = sqlquery(SELECT COUNT('id_membre') AS nbr, 'id_membre', 
'pseudo_membre', 'mdp_membre' FROM 'espace_membre2'.'membres2' WHERE 
'pseudo_membre' = '\'.mysql_real_escape_string($_POST['pseudo']).\'' GROUP BY 
'id_membre', 1);

I tried several delimitator for the query function (like ' \* ').


  

Re: sql syntax error

2014-08-08 Thread Johan De Meersman
- Original Message -
 From: florent larose florent.lar...@hotmail.com
 Subject: sql syntax error
 
 near ''membres2' WHERE
 [...]
  FROM 'espace_membre2'.'membres2' WHERE

You were on the right path - mysql is wibbly about quotes. Either remove the 
quotes entirely ( espace_membre2.membres2 ) or try backticks ( ` ). They're 
MySQL's favourite quote, presumably because they were convenient to type on 
whatever abomination Monty used to type code :-)

As your code is french, I'll assume you're on Azerty; the backtick is Alt-Gr 
plus the rightmost key (right next to return) on the middle row. Enjoy 
spraining your fingers :-p

/johan

-- 
Unhappiness is discouraged and will be corrected with kitten pictures.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: sql syntax error

2014-08-08 Thread Christophe
Hi,

Le 08/08/2014 17:48, Johan De Meersman a écrit :
 
 As your code is french, I'll assume you're on Azerty; the backtick is Alt-Gr 
 plus the rightmost key (right next to return) on the middle row. Enjoy 
 spraining your fingers :-p
 
 /johan
 

Alt-GR plus '7' for French keyboard layout ;)


Christophe.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: Now() : SQL syntax error. But why?

2009-04-30 Thread Antonio PHP
Thanks, Scott.

I thought I couldn't have missed ','(comma) before. But today somehow it
works... ;;
I wasted hours figuring this out, but you saved me!

Maybe I'm still a complete newbie!

Thanks, again. Have a great day. :)



On Thu, Apr 30, 2009 at 12:52 PM, Scott Haneda talkli...@newgeo.com wrote:


 On Apr 29, 2009, at 11:29 AM, Antonio PHP wrote:

 This is MySQL data structure. - I underlined where it causes the error
 message. (datetime)
 `id_Company` smallint(6) unsigned NOT NULL AUTO_INCREMENT,
 `Name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
 `Revenue` mediumint(6) NOT NULL,
 `Company_Size` mediumint(6) NOT NULL,
 `Ownership` tinyint(1) NOT NULL,
 `Homepage` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT
 NULL,
 `Job_Source` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT
 NULL,
 `Updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
 *`Created` datetime NOT NULL,
 *PRIMARY KEY (`id_Company`),
 KEY `Ownership` (`Ownership`)
 )
 ENGINE=InnoDB  DEFAULT CHARSET=utf8
 FOREIGN KEY (`Ownership`) REFERENCES `ownership` (`id_Ownership`) ON
 DELETE
 CASCADE ON UPDATE CASCADE;


 Next time can you include unmodified SQL so it is a copy and paste for me,
 rather than debugging what changes you made that are causing error.

 Here is php script -
 $sql = INSERT INTO company SET
 Name='$Name',
 Revenue='$Revenue',
 Company_Size='$Company_Size',
 Ownership='$Ownership',
 Homepage='$Homepage',
 Job_Source='$Job_Source'
 *Created=NOW() // if I remove this line it works fine.
 *;
 mysql_query ($sql) or die (mysql_error());


 Same here, as I am not sure your edits are just edits, or the lack of a
 comma after the job source variable is the issue.

 This works on my end:

 $Name = 'Tom';
 $Revenue  = '100';
 $Company_Size = '500';
 $Ownership= 'partner';
 $Homepage = 'example.com';
 $Job_Source   = 'friend';


 $sql = INSERT INTO mailing SET
 Name='$Name',
 Revenue='$Revenue',
 Company_Size='$Company_Size',
 Ownership='$Ownership',
 Homepage='$Homepage',
 Job_Source='$Job_Source',
 Created=NOW();

 echo $sql;

 mysql_query ($sql) or die (mysql_error());

  --
 Scott * If you contact me off list replace talklists@ with scott@ *




Re: Now() : SQL syntax error. But why?

2009-04-30 Thread Scott Haneda
Always echo out your SQL string, it will make it a lot more obvious.   
You want to see the result.  I php concatenated string can be  
confusing at times.


Also, you are not escaping your data, so if you had a word of 'stops,  
here' that would break it as well.


So in your case, you very well may break it by changing the data you  
put in.  You could also do something like stuffing drop database  
foo; into your data, and be in for real fun.


Pass every string to http://us2.php.net/mysql_real_escape_string

On Apr 30, 2009, at 9:27 PM, Antonio PHP wrote:

I thought I couldn't have missed ','(comma) before. But today  
somehow it works... ;;

I wasted hours figuring this out, but you saved me!

Maybe I'm still a complete newbie!


--
Scott * If you contact me off list replace talklists@ with scott@ *


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



Re: Now() : SQL syntax error. But why?

2009-04-29 Thread Antonio PHP
Thanks. NOW() and php date(); work for my newly created test tables, but it
doesn't work for my working table. I can't insert date, time or now()
into my old table (which is as below).

For now, I'm using MySQL auto timestamp ('Updated' field), but I need to
insert date when the data was created!

Why is this? Please help me. (I'm using the newest versions of PHP and
MySQL)

This is MySQL data structure. - I underlined where it causes the error
message. (datetime)
`id_Company` smallint(6) unsigned NOT NULL AUTO_INCREMENT,
`Name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
`Revenue` mediumint(6) NOT NULL,
`Company_Size` mediumint(6) NOT NULL,
`Ownership` tinyint(1) NOT NULL,
`Homepage` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`Job_Source` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT
NULL,
`Updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
*`Created` datetime NOT NULL,
*PRIMARY KEY (`id_Company`),
KEY `Ownership` (`Ownership`)
)
ENGINE=InnoDB  DEFAULT CHARSET=utf8
FOREIGN KEY (`Ownership`) REFERENCES `ownership` (`id_Ownership`) ON DELETE
CASCADE ON UPDATE CASCADE;

Here is php script -
$sql = INSERT INTO company SET
Name='$Name',
Revenue='$Revenue',
Company_Size='$Company_Size',
Ownership='$Ownership',
Homepage='$Homepage',
Job_Source='$Job_Source'
*Created=NOW() // if I remove this line it works fine.
*;
mysql_query ($sql) or die (mysql_error());


Also, this doesn't work for this table.
$Datetime = date( 'Y-m-d H:i:s');

INSERT INTO 
Created='$Datetime'...



On Wed, Apr 29, 2009 at 9:28 AM, Scott Haneda talkli...@newgeo.com wrote:

 We need to see your entire query and the table structure.  timestamp fields
 can have options set to auto update them, where order matters, and only one
 field can support that feature.

 Please supply more data.


 On Apr 28, 2009, at 2:18 PM, Antonio PHP wrote:

 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 'Created =
 NOW(),
 Updated = NOW()' at line 8

 'Created' and 'Updated' are set to datetime (InnoDB).

 The same syntax works for some newly created tables... and gives no error.

 It's very strange. 'Now()' works for some tables, and it doesn't for some.
 (All set in phpmyadmin...)

 What could have caused this? Any similar experience?


 --
 Scott * If you contact me off list replace talklists@ with scott@ *




Re: Now() : SQL syntax error. But why?

2009-04-29 Thread Scott Haneda


On Apr 29, 2009, at 11:29 AM, Antonio PHP wrote:


This is MySQL data structure. - I underlined where it causes the error
message. (datetime)
`id_Company` smallint(6) unsigned NOT NULL AUTO_INCREMENT,
`Name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
`Revenue` mediumint(6) NOT NULL,
`Company_Size` mediumint(6) NOT NULL,
`Ownership` tinyint(1) NOT NULL,
`Homepage` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci  
NOT NULL,
`Job_Source` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci  
NOT

NULL,
`Updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
*`Created` datetime NOT NULL,
*PRIMARY KEY (`id_Company`),
KEY `Ownership` (`Ownership`)
)
ENGINE=InnoDB  DEFAULT CHARSET=utf8
FOREIGN KEY (`Ownership`) REFERENCES `ownership` (`id_Ownership`) ON  
DELETE

CASCADE ON UPDATE CASCADE;


Next time can you include unmodified SQL so it is a copy and paste for  
me, rather than debugging what changes you made that are causing error.



Here is php script -
$sql = INSERT INTO company SET
Name='$Name',
Revenue='$Revenue',
Company_Size='$Company_Size',
Ownership='$Ownership',
Homepage='$Homepage',
Job_Source='$Job_Source'
*Created=NOW() // if I remove this line it works fine.
*;
mysql_query ($sql) or die (mysql_error());


Same here, as I am not sure your edits are just edits, or the lack of  
a comma after the job source variable is the issue.


This works on my end:

 $Name = 'Tom';
 $Revenue  = '100';
 $Company_Size = '500';
 $Ownership= 'partner';
 $Homepage = 'example.com';
 $Job_Source   = 'friend';


 $sql = INSERT INTO mailing SET
 Name='$Name',
 Revenue='$Revenue',
 Company_Size='$Company_Size',
 Ownership='$Ownership',
 Homepage='$Homepage',
 Job_Source='$Job_Source',
 Created=NOW();

 echo $sql;

 mysql_query ($sql) or die (mysql_error());

--
Scott * If you contact me off list replace talklists@ with scott@ *


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



Now() : SQL syntax error. But why?

2009-04-28 Thread Antonio PHP
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 'Created = NOW(),
Updated = NOW()' at line 8

'Created' and 'Updated' are set to datetime (InnoDB).

The same syntax works for some newly created tables... and gives no error.

It's very strange. 'Now()' works for some tables, and it doesn't for some.
(All set in phpmyadmin...)

What could have caused this? Any similar experience?

Please help~.


Re: Now() : SQL syntax error. But why?

2009-04-28 Thread Martijn Engler
Can you please give the full table structure and query?

On Tue, Apr 28, 2009 at 23:18, Antonio PHP php.anto...@gmail.com wrote:
 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 'Created = NOW(),
 Updated = NOW()' at line 8

 'Created' and 'Updated' are set to datetime (InnoDB).

 The same syntax works for some newly created tables... and gives no error.

 It's very strange. 'Now()' works for some tables, and it doesn't for some.
 (All set in phpmyadmin...)

 What could have caused this? Any similar experience?

 Please help~.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



Re: Now() : SQL syntax error. But why?

2009-04-28 Thread Scott Haneda
We need to see your entire query and the table structure.  timestamp  
fields can have options set to auto update them, where order matters,  
and only one field can support that feature.


Please supply more data.

On Apr 28, 2009, at 2:18 PM, Antonio PHP wrote:

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 'Created  
= NOW(),

Updated = NOW()' at line 8

'Created' and 'Updated' are set to datetime (InnoDB).

The same syntax works for some newly created tables... and gives no  
error.


It's very strange. 'Now()' works for some tables, and it doesn't for  
some.

(All set in phpmyadmin...)

What could have caused this? Any similar experience?


--
Scott * If you contact me off list replace talklists@ with scott@ *


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



SQL syntax error: help a noob

2005-01-31 Thread Chris Kavanagh
Dear list,
My ColdFusion server tells me I have an error in my query syntax, but I 
can't work out what it is - because I'm working with code that someone 
very kindly gave me and I only have a vague idea of what the first 
line's doing!  Can anyone see the problem here?

SELECT DATEDIFF(leadtime_type, GETDATE(), deadline)'Difference',
		tasks.leadtime,
		tasks.lead_time_type_id,
		leadtime_type.leadtime_type
FROM tasks
		JOIN leadtime_type ON tasks.lead_time_type_id = 
leadtime_type.leadtime_type_id

Thanks in advance,
CK.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: SQL syntax error: help a noob

2005-01-31 Thread Roger Baklund
Chris Kavanagh wrote:
My ColdFusion server tells me I have an error in my query syntax, but I 
can't work out what it is - because I'm working with code that someone 
very kindly gave me and I only have a vague idea of what the first 
line's doing!  Can anyone see the problem here?

SELECT DATEDIFF(leadtime_type, GETDATE(), deadline)'Difference',
tasks.leadtime,
tasks.lead_time_type_id,
leadtime_type.leadtime_type
FROM tasks
JOIN leadtime_type ON tasks.lead_time_type_id = 
leadtime_type.leadtime_type_id
It would be helpfll if you told us what error message you got, and what 
version of MySQL you are using.

The only obvious error I can spot is GETDATE(), this is not a standard 
MySQL function. Try CURDATE().

--
Roger
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: SQL syntax error: help a noob

2005-01-31 Thread Tom Crimmins
[snip]
My ColdFusion server tells me I have an error in my query syntax, but I
can't work out what it is - because I'm working with code that someone very
kindly gave me and I only have a vague idea of what the first line's doing!
Can anyone see the problem here?

SELECT DATEDIFF(leadtime_type, GETDATE(), deadline)'Difference',
tasks.leadtime,
tasks.lead_time_type_id,
leadtime_type.leadtime_type
FROM tasks
JOIN leadtime_type ON tasks.lead_time_type_id =
leadtime_type.leadtime_type_id
[/snip]

The datediff() function is new to version 4.1. What version of mysql are you
running?

---
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: SQL syntax error: help a noob

2005-01-31 Thread Chris Kavanagh
Thanks very much for the replies, guys.  My version is 4.1.7-max.
The error message I get is:
--
Error Executing Database Query.
Syntax error or access violation: 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 ' deadline)'Difference',  tasks.leadtime,  
tasks.lead_time_type_id,  leadtime_' at line 1
--

I changed GETDATE() to CURDATE() but it still gives me the same error.  
Thanks for the suggestion anyway, Roger.

Best regards,
CK.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: SQL syntax error: help a noob

2005-01-31 Thread Tom Crimmins
I think datediff only takes two arguments and you have three listed.

---
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa


-Original Message-
From: Chris Kavanagh
Sent: Monday, January 31, 2005 5:33 PM
To: mysql@lists.mysql.com
Subject: Re: SQL syntax error: help a noob

Thanks very much for the replies, guys.  My version is 4.1.7-max.

The error message I get is:
--
Error Executing Database Query.

Syntax error or access violation: 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 ' deadline)'Difference',  tasks.leadtime,
tasks.lead_time_type_id,  leadtime_' at line 1
--

I changed GETDATE() to CURDATE() but it still gives me the same error.  
Thanks for the suggestion anyway, Roger.

Best regards,
CK.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



SOLVED: SQL syntax error: help a noob

2005-01-31 Thread Chris Kavanagh
On 31 Jan 2005, at 11:39 pm, Tom Crimmins wrote:
I think datediff only takes two arguments and you have three listed.
Nailed it!  Thanks, Tom.
Best regards,
CK.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


SQL syntax error

2004-11-13 Thread Stuart Felenstein
I've had this going over on the php-general list. 
Thought I would throw it out here . Running PHP 4.0.22

Keep getting this error - 
SELECT PostStart, JobTitle, Industry, LocationState,
VendorID FROM VendorJobsSELECT PostStart, JobTitle,
Industry, LocationState, VendorID FROM VendorJobsWHERE
VendorJobs.Industry = '2','3','4','5'Query failed: 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 '.Industry = '2','3','4','5''
at line 2

The first is the printout of my statement followed by
the mysql_error .
Here is my code.  This is driving me nuts.  Sorry


$sql = SELECT PostStart, JobTitle, Industry,
LocationState, VendorID
FROM VendorJobs;
echo $sql;
//if ($Ind)
$sql .= WHERE VendorJobs.Industry = $s_Ind;

As you can see above s_ind is an array , comma
delimited.  To me this all looks fine. to the parser,
well ;)

Stuart

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: SQL syntax error

2004-11-13 Thread Jim Winstead
On Sat, Nov 13, 2004 at 12:30:43PM -0800, Stuart Felenstein wrote:
 $sql = SELECT PostStart, JobTitle, Industry,
 LocationState, VendorID
 FROM VendorJobs;
 echo $sql;
 //if ($Ind)
 $sql .= WHERE VendorJobs.Industry = $s_Ind;
 
 As you can see above s_ind is an array , comma
 delimited.  To me this all looks fine. to the parser,
 well ;)

You can't compare a column with a comma-delimited list of numbers like
that, and you also want to make sure there is a space before the 'WHERE'
keyword. You want:

  $sql .=  WHERE VendorJobs.Industry IN ($s_Ind);

-- 
Jim Winstead
MySQL Inc.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: SQL syntax error

2004-11-13 Thread Stuart Felenstein

--- Jim Winstead [EMAIL PROTECTED] wrote:

 You can't compare a column with a comma-delimited
 list of numbers like
 that...

What should the seperator be then ?

Thank you 
Stuart

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: SQL syntax error

2004-11-13 Thread Jim Winstead
On Sat, Nov 13, 2004 at 12:46:12PM -0800, Stuart Felenstein wrote:
 
 --- Jim Winstead [EMAIL PROTECTED] wrote:
 
  You can't compare a column with a comma-delimited
  list of numbers like
  that...
 
 What should the seperator be then ?

My point was that you can't compare a column with an array
of numbers using the '=' operator. You have to use the IN
operator, as in the line of code I posted:

  $sql .=  WHERE VendorJobs.Industry IN ($s_Ind);

(where $s_Ind is a comma-delimited list of numbers or
quoted strings.)

-- 
Jim Winstead
MySQL Inc.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re:[SOLVED] SQL syntax error

2004-11-13 Thread Stuart Felenstein
--- Jim Winstead [EMAIL PROTECTED] wrote:

 My point was that you can't compare a column with an
 array
 of numbers using the '=' operator. You have to use
 the IN
 operator, as in the line of code I posted:


Thank you Jim , it's working now!

Stuart 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



MySQL -- SQL syntax error.....

2004-06-16 Thread Scott Fletcher
When I use this SQL statement, ...

--snip--
UPDATE BUSINESS_CATEGORY SET
(BUSINESS_CATEGORY.BUS_CAT,BUSINESS_CATEGORY.BUS_DESC) =
('JUNKKK','JUNK123KK') WHERE BUSINESS_CATEGORY.BUS_CAT_ID = '733788' 
--snip--

I get the SQL syntax error saying, 

--snip--
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
'(BUSINESS_CATEGORY.BUS_CAT,BUSINESS_CATEGORY.BUS_DESC) = ('JUNK 
--snip--

So, I looked up in MySQL's documentation at
http://dev.mysql.com/doc/mysql/en/UPDATE.html, it didn't say anything
helpful about the SQL syntax.  So, what did I do wrong??

Thanks,
 Scott F.



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: MySQL -- SQL syntax error.....

2004-06-16 Thread Mike Johnson
From: Scott Fletcher [mailto:[EMAIL PROTECTED]

 When I use this SQL statement, ...
 
 --snip--
 UPDATE BUSINESS_CATEGORY SET
 (BUSINESS_CATEGORY.BUS_CAT,BUSINESS_CATEGORY.BUS_DESC) =
 ('JUNKKK','JUNK123KK') WHERE BUSINESS_CATEGORY.BUS_CAT_ID = '733788' 
 --snip--
 
 I get the SQL syntax error saying, 
 
 --snip--
 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
 '(BUSINESS_CATEGORY.BUS_CAT,BUSINESS_CATEGORY.BUS_DESC) = ('JUNK 
 --snip--
 
 So, I looked up in MySQL's documentation at
 http://dev.mysql.com/doc/mysql/en/UPDATE.html, it didn't say anything
 helpful about the SQL syntax.  So, what did I do wrong??

I don't think MySQL supports using parens in that regard.

Try this:

UPDATE BUSINESS_CATEGORY SET
BUSINESS_CATEGORY.BUS_CAT = 'JUNKKK', 
BUSINESS_CATEGORY.BUS_DESC = 'JUNK123KK'
WHERE BUSINESS_CATEGORY.BUS_CAT_ID = '733788'


-- 
Mike Johnson
Web Developer
Smarter Living, Inc.
phone (617) 886-5539

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: MySQL -- SQL syntax error.....

2004-06-16 Thread SGreen

Try this:
UPDATE BUSINESS_CATEGORY
SET BUSINESS_CATEGORY.BUS_CAT = 'JUNKKK'
  ,BUSINESS_CATEGORY.BUS_DESC = 'JUNK123KK'
WHERE BUSINESS_CATEGORY.BUS_CAT_ID = '733788'



   
 
  Scott Fletcher 
 
  [EMAIL PROTECTED]To:   [EMAIL PROTECTED]  
  
  com cc: 
 
   Fax to: 
 
  06/16/2004 04:08 Subject:  MySQL -- SQL syntax 
error. 
  PM   
 
   
 
   
 




When I use this SQL statement, ...

--snip--
UPDATE BUSINESS_CATEGORY SET
(BUSINESS_CATEGORY.BUS_CAT,BUSINESS_CATEGORY.BUS_DESC) =
('JUNKKK','JUNK123KK') WHERE BUSINESS_CATEGORY.BUS_CAT_ID = '733788'
--snip--

I get the SQL syntax error saying, 

--snip--
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
'(BUSINESS_CATEGORY.BUS_CAT,BUSINESS_CATEGORY.BUS_DESC) = ('JUNK
--snip--

So, I looked up in MySQL's documentation at
http://dev.mysql.com/doc/mysql/en/UPDATE.html, it didn't say anything
helpful about the SQL syntax.  So, what did I do wrong??

Thanks,
 Scott F.



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]







-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



sql syntax error

2004-04-20 Thread Aaron P. Martinez
I'm using amavisd-new -20030616p9, RH 3.0 ES and mysql 3.23.58-1 trying
to do sql lookups for user prefs.  I've done this before and have
compared my sql statements and can't figure out the problem. 

When i start amavisd-new with the debug switch, here's what i get:

# /usr/local/sbin/amavisd debug
Error in config file /etc/amavisd.conf: syntax error at
/etc/amavisd.conf line 829, near ' ORDER BY users.priority DESC ';

Here are the lines from my /etc/amavisd.conf file:

$sql_select_policy = 'SELECT *,users.vuid FROM users,policy_names'.
  ' WHERE (users.policy=policy_names.id) AND (users.username IN (%k))'.
  ' ORDER BY users.priority DESC ';

Please help!

Thanks in advance,

Aaron


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



SQL syntax error

2004-01-01 Thread Asif Iqbal
Hi All

I have been pushing my syslogs to the following mysql table

However whenever it sees lines with a ' (apostrophe) it complains about SQL syntax

Here are two lines with ' from my syslog:

Jan  1 03:58:15 dal-svcs-02.inet.qwest.net 203: *Jan  1 08:58:13.926
UTC: %PFINIT-SP-5-CONFIG_SYNC: Sync'ing the startup configuration to the standby Router

Jan 01 00:57:06 [65.119.67.5.17.126] %NTP-W-NOTIMEZONE, Time will not be
set until timezone is configured; use 'system set timezone' to configure

Here is how it complains: 

failed to run query: 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 'ing the startup configuration to the standby Router
')' at line

failed to run query: 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 'system set timezone' to configure
', '087) (RST)
')' at line 1

Here is how my mysql table looks like

+---+--+--+-+-++
| Field | Type | Null | Key | Default | Extra  |
+---+--+--+-+-++
| id| int(11)  |  | PRI | NULL| auto_increment |
| timestamp | varchar(16)  | YES  | | NULL||
| host  | varchar(255) | YES  | | NULL||
| prog  | varchar(255) | YES  | | NULL||
| mesg  | text | YES  | | NULL||
+---+--+--+-+-++

Is there anyway I can modify the host,prog and mesg field types to
accept apostrophe as part of the record ?

Thanks for all the help

(Happy New Year !!)
-- 
Asif Iqbal
http://pgpkeys.mit.edu:11371/pks/lookup?op=getsearch=0x8B686E08
There's no place like 127.0.0.1

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: SQL syntax error

2004-01-01 Thread Frederic Wenzel
Hi Asif,

Asif Iqbal wrote:
I have been pushing my syslogs to the following mysql table

However whenever it sees lines with a ' (apostrophe) it complains about SQL syntax
You need to escape those reserved characters, i.e. have ' replaced by \' 
because otherwise mysql will treat the apostrophe as the string 
delimiting character.

Greets
Fred
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Replication halts with sql syntax error

2003-01-13 Thread markb
Description:
There seems to be a problem with mysql replication. When the slave server encounters 
sql that uses backticks instead of single quotes. The
+replication stops until you manually advance the position number in the master.info 
+file.
How-To-Repeat:
1. Set up a replication server
2. enter in sql on the master server using backticks instead of singlequotes
   eg. DROP TABLE `ee_camera`, `ee_camera_type`, `ee_category`, `ee_counter`, 
`ee_country`, `ee_exhibition`, `ee_exhibition_feedback`,
+`ee_lens`, `ee_light`, `ee_location`, `ee_message`, `ee_microthumb_path`, `ee_news`, 
+`ee_owner`, `ee_photo`, `ee_photo_size`,
+`ee_photo_to_category`, `ee_photo_to_exhibition`, `ee_size`, `ee_thumb_path`, 
+`ee_thumbs`, `ee_workflow`
3. Watch the error log on the slave, it will stop replication at this point.
Fix:
Submitter-Id:  submitter ID
Originator:markb
Organization:
 Server101.com
MySQL support: none
Synopsis:  Replication halts with sql syntax error
Severity:  serious
Priority:  medium
Category:  mysql
Class: sw-bug
Release:   mysql-3.23.54 (Official MySQL RPM)
Server: /usr/bin/mysqladmin  Ver 8.23 Distrib 3.23.54, for pc-linux on i686
Copyright (C) 2000 MySQL AB  MySQL Finland AB  TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version  3.23.54-Max
Protocol version10
Connection  Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 7 hours 45 min 44 sec

Threads: 1  Questions: 50694  Slow queries: 0  Opens: 4433  Flush tables: 1  Open 
tables: 64 Queries per second avg: 1.814
Environment:
Intel, Redhat 7.2
System: Linux launch.server101.com 2.4.16-xfs #2 SMP Tue Jan 15 05:26:12 EST 2002 i686 
unknown
Architecture: i686

Some paths:  /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc /usr/bin/cc
GCC: Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 2731 (Red Hat Linux 7.2 2.96-112.7.1)
Compilation info: CC='gcc'  CFLAGS='-O6 -fno-omit-frame-pointer -mpentium'  CXX='gcc'  
CXXFLAGS='-O6 -fno-omit-frame-pointer  -felide-constructors 
-fno-exceptions -fno-rtti -mpentium'  LDFLAGS=''
LIBC: 
lrwxrwxrwx1 root root   13 Nov  8 02:13 /lib/libc.so.6 - libc-2.2.4.so
-rwxr-xr-x1 root root  1285884 Oct 11 03:19 /lib/libc-2.2.4.so
-rw-r--r--1 root root 27338282 Oct 11 02:48 /usr/lib/libc.a
-rw-r--r--1 root root  178 Oct 11 02:48 /usr/lib/libc.so
lrwxrwxrwx1 root root   10 May 28  2002 /usr/lib/libc-client.a - 
c-client.a
Configure command: ./configure '--disable-shared' '--with-mysqld-ldflags=-all-static' 
'--with-client-ldflags=-all-static' '--without-berkeley-db' '--without-innodb' 
'--enable-assembler' '--enable-local-infile' '--with-mysqld-user=mysql' 
'--with-unix-socket-path=/var/lib/mysql/mysql.sock' '--prefix=/' 
'--with-extra-charsets=complex' '--exec-prefix=/usr' '--libexecdir=/usr/sbin' 
'--sysconfdir=/etc' '--datadir=/usr/share' '--localstatedir=/var/lib/mysql' 
'--infodir=/usr/share/info' '--includedir=/usr/include' '--mandir=/usr/share/man' 
'--with-comment=Official MySQL RPM' 'CC=gcc' 'CFLAGS=-O6 -fno-omit-frame-pointer 
-mpentium' 'CXXFLAGS=-O6 -fno-omit-frame-pointer   -felide-constructors 
-fno-exceptions -fno-rtti -mpentium' 'CXX=gcc'


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




SQL syntax error

2001-11-30 Thread Steve Osborne

Sorry for the repost of this problem, but I can't find the answer anywhere,
and I'm stuck here until I solve this.

I am receiving the following error when I try to restore a database backup
from an .sql file:
ERROR 1064 at line 12: You have an error in your SQL syntax near
'PACK_KEYS=1' at line 11

Code used:
DROP TABLE IF EXISTS Advertisers;
CREATE TABLE Advertisers (
  AdvertisersKey smallint(5) unsigned NOT NULL auto_increment,
  AdvertiserID int(11) NOT NULL default '0',
  Advertiser char(50) NOT NULL default '',
  AdvertiserFr char(50) default NULL,
  AdvertDescr char(250) default NULL,
  PRIMARY KEY  (AdvertisersKey),
  UNIQUE KEY AdvertiserID (AdvertiserID),
  KEY IdxAdvert (Advertiser(10)),
  UNIQUE KEY Advertiser (Advertiser)
) TYPE=ISAM PACK_KEYS=1;

Cmd used to create sql:
mysqldump --user=username --add-drop-table -pblahblah
dbdatabasenamefilename.sql

Cmd used to restore from sql:
mysql --user=root -p backupdatabasenamefilename.sql

Can anybody help me?

Steve Osborne
Database Programmer
Chinook Multimedia Inc.




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: SQL syntax error

2001-11-30 Thread Steve Osborne

I created the file with ver 3.23.43, tried to recreate database on 3.22.32.
I administer 2 other databases the same commands and they work fine.  I
looked at the difference in the sql files, and those ones don't contain the
PACK_KEYS statement...just TYPE=myISAM.  The command used to create the sql
files hasn't changed, and the databases are hosted by the same ISP.  It's a
confusing situation.  I don't want to have to go back and manually change
each .sql file each day to complete the backup process.  I wouldn't get any
other work done.

Any other suggestions?

Steve
[EMAIL PROTECTED]

- Original Message -
From: Steve Werby [EMAIL PROTECTED]
To: Steve Osborne [EMAIL PROTECTED]; MySQL (E-mail)
[EMAIL PROTECTED]
Sent: Friday, November 30, 2001 2:58 PM
Subject: Re: SQL syntax error


 Steve Osborne [EMAIL PROTECTED] wrote:
  I am receiving the following error when I try to restore a database
backup
  from an .sql file:
  ERROR 1064 at line 12: You have an error in your SQL syntax near
  'PACK_KEYS=1' at line 11
 snip
  ) TYPE=ISAM PACK_KEYS=1;
 /snip
 
  Cmd used to create sql:
  mysqldump --user=username --add-drop-table -pblahblah
  dbdatabasenamefilename.sql
 
  Cmd used to restore from sql:
  mysql --user=root -p backupdatabasenamefilename.sql

 You didn't mention your version of MySQL, but I suspect it's old.  Remove
 the PACK_KEYS=1 text and it should work fine.  I also suggest upgrading
to
 a more recent MySQL if in fact you're running an older version.

 --
 Steve Werby
 President, Befriend Internet Services LLC
 http://www.befriend.com/


 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php






-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: SQL syntax error

2001-11-30 Thread Dan Nelson

In the last episode (Nov 30), Steve Osborne said:
 I created the file with ver 3.23.43, tried to recreate database on
 3.22.32. I administer 2 other databases the same commands and they
 work fine.  I looked at the difference in the sql files, and those
 ones don't contain the PACK_KEYS statement...just TYPE=myISAM.  The
 command used to create the sql files hasn't changed, and the
 databases are hosted by the same ISP.  It's a confusing situation.  I
 don't want to have to go back and manually change each .sql file each
 day to complete the backup process.  I wouldn't get any other work
 done.
 
 Any other suggestions?

* Upgrade the 2nd server to mysql 3.23 (preferable).  It's really old.

* Remove the PACK_KEYS flag from the 1st server's tables.

  mysql ALTER TABLE mytable PACK_KEYS=0;

* Parse the mysqldump output to remove the PACK_KEYS flag before loading:

  mysqldump -h oldhost db | sed -e 's/ PACK_KEYS=1//' | mysql -h newhost db

-- 
Dan Nelson
[EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




SQL- syntax... error using interchange and mysql

2001-02-04 Thread Boyd Lynn Gerber

I keep getting this error.

table products created: create table products (
sku VARCHAR(20) NOT NULL PRIMARY KEY,
description VARCHAR(255) NOT NULL,
price DECIMAL(12,2) NOT NULL, index(price),
author_editor VARCHAR(80),
isbn VARCHAR(20),
url VARCHAR(40),
title VARCHAR(128) DEFAULT '' NOT NULL, index(title),
template_page VARCHAR(64),
comment__MVC_FIELDMUNGE__ char(128),
display VARCHAR(128),
image VARCHAR(64),
wholesale char(128),
category VARCHAR(64) NOT NULL, index(category),
nontaxable CHAR(3),
weight VARCHAR(12) DEFAULT '0' NOT NULL,
size__MVC_FIELDMUNGE__ char(128),
color VARCHAR(96),
gift_cert VARCHAR(3),
related TEXT,
featured VARCHAR(32),
download char(128),
dl_type char(128),
dl_location char(128),
inactive char(128)
)

signat config error: You have an error in your SQL syntax near ' '', '',
'', '',
 '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',' at line 1


This is the tab delimited first and part of the second line.

sku description price   author_editor   isbnurl title   template_page  
 comment__MVC_FIELDMUNGE__   display image   wholesale   category
nontaxable  weight  size__MVC_FIELDMUNGE__  color   gift_cert
related featureddownloaddl_type dl_location inactive
1-56085-123-6  An Abundant Life: The Memoirs of Hugh B. Brown  17.95
Edwin B. Firmage, editor1-56085-123-6   abundant.htm...


Thanks,

--
Boyd Gerber [EMAIL PROTECTED]
ZENEZ   3748 Valley Forge Road, Magna Utah  84044
Office 801-250-0795 FAX 801-250-7975


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php