Gossamer Forum
Home : General : Perl Programming :

execute failed: You have an error in your SQL syntax near 'Maturity =Y

Quote Reply
execute failed: You have an error in your SQL syntax near 'Maturity =Y
[Fri Jan 09 11:49:27 2004] [error] [client 127.0.0.1] Premature end of script headers: dolphin_edit.pl
[Fri Jan 09 11:49:27 2004] [error] [client 127.0.0.1] DBD::mysql::st execute failed: You have an error in your SQL syntax near 'Maturity =Y
[Fri Jan 09 11:49:27 2004] [error] [client 127.0.0.1] Age =12
[Fri Jan 09 11:49:27 2004] [error] [client 127.0.0.1] Length =2.50
[Fri Jan 09 11:49:27 2004] [error] [client 127.0.0.1] Notes =2.50
[Fri Jan 09 11:49:27 2004] [error] [client 127.0.0.1] WHERE CD' at line 2 at C:/Program Files/Apache Group/Apache2/cgi-bin/dolphin_edit.pl line 28.
[Fri Jan 09 11:49:27 2004] [error] [client 127.0.0.1]
[Fri Jan 09 11:49:27 2004] [error] [client 127.0.0.1] (1064): You have an error in your SQL syntax near 'Maturity =Y
[Fri Jan 09 11:49:27 2004] [error] [client 127.0.0.1] Age =12
[Fri Jan 09 11:49:27 2004] [error] [client 127.0.0.1] Length =2.50
[Fri Jan 09 11:49:27 2004] [error] [client 127.0.0.1] Notes =2.50
[Fri Jan 09 11:49:27 2004] [error] [client 127.0.0.1] WHERE CD' at line 2
Quote Reply
Re: [Silver Machine] execute failed: You have an error in your SQL syntax near 'Maturity =Y In reply to
Got the commas, it moved it on a bit further but still sticking I have fiddled around a bit bu no look I got the IN bit from Using subqueries part 2 on DevShed site but it is not used in an example the way I am trying to use it is is a valid use?.


[Fri Jan 09 13:01:20 2004] [error] [client 127.0.0.1] FROM Guide ' at line 5 at C:/Program Files/Apache Group/Apache2/cgi-bin/dolphin_edit.pl line 29.
[Fri Jan 09 13:01:20 2004] [error] [client 127.0.0.1]
[Fri Jan 09 13:01:20 2004] [error] [client 127.0.0.1] (1064): You have an error in your SQL syntax near '
[Fri Jan 09 13:01:20 2004] [error] [client 127.0.0.1] WHERE CD00302 IN (Select Code
[Fri Jan 09 13:01:20 2004] [error] [client 127.0.0.1] FROM Guide ' at line 5

$DBH = DBI->connect('DBI:mysql:Dolphin') or die "\n ($DBI::err) : $DBI::errstr\n";
$statement = qq{UPDATE Guide SET Sex =$Sex,
Maturity =$Maturity,
Age =$Age,
Length =$Length,
Notes =$Note,
WHERE $Code IN (Select Code
FROM Guide
WHERE Guide.Code like $Code
AND Guide.Name like $Name
AND Guide.Family like $Family)
};
Quote Reply
Re: [Silver Machine] execute failed: You have an error in your SQL syntax near 'Maturity =Y In reply to
Hey Chris,

It looks like a problem with your SQL syntax. Try writing out the SQL statement filling in the scalar values with actual data and post in the SQL forum. Maybe one of the SQL wizards can help you with the syntax.

~Charlie
Quote Reply
Re: [Chaz] execute failed: You have an error in your SQL syntax near 'Maturity =Y In reply to
Just for anyone else having this problem The syntax error is because:

WHERE x IN (subselect) will only work in mysql 4.1+

So no matter how I re hashed it I would never get it to work! I will now have to start again!

Chris