Error returned is:
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
''id_partenaire','logo_partenaire','logo_tnb','favicon','global_primary_color','g'
at line 1
This is my query:
INSERT
INTO
CONFIGURATIONS_PARTENAIRES
('id_partenaire','logo_partenaire','logo_tnb','favicon','global_primary_color','global_secondary_color','global_infos_color','global_font_color','font_color_dark','font_color_light','moteur_ht','moteur_og','moteur_ht_primary_color','moteur_ht_secondary_color','moteur_og_primary_color','moteur_og_secondary_color')
VALUES
(16,'logo-2020-350x73-1.png','logo_tb.png','icon.gif','#ebebeb','#ffffff','#f50e98','#000000','#ffffff','#f06f05','1','1','#000000','#f06f05','#000000','#f06f05');
With back ticks instead of the quotes on the column names it should run better
INSERT INTO
CONFIGURATIONS_PARTENAIRES
(`id_partenaire`,
`logo_partenaire`,
`logo_tnb`,
`favicon`,
`global_primary_color`,
`global_secondary_color`,
`global_infos_color`,
`global_font_color`,
`font_color_dark`,
`font_color_light`,
`moteur_ht`,
`moteur_og`,
`moteur_ht_primary_color`,
`moteur_ht_secondary_color`,
`moteur_og_primary_color`,
`moteur_og_secondary_color`)
VALUES
( 16
,'logo2020-350x73-1.png'
,'logo_tb.png'
,'icon.gif'
,'#ebebeb'
,'#ffffff'
,'#f50e98'
,'#000000'
,'#ffffff'
,'#f06f05'
,'1'
,'1'
,'#000000'
,'#f06f05'
,'#000000'
,'#f06f05');
These lines give me the parse error, ı checked my syntax many times but it seems alright to me. I don't understand why does it give this error
code:
INSERT INTO club_request(RequestID,"Besiktas")
SELECT RequestID
FROM Request
WHERE RequestName = "New goalkeeper";
error:
ER_PARSE_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 '"Besiktas") SELECT RequestID FROM Request WHERE RequestName = "New goalkeeper"' at line 1
INSERT INTO club_request(RequestID, ClubName)
SELECT RequestID, ClubName
FROM Request, Club
WHERE RequestName = "New goalkeeper" AND ClubName = "Besiktas";
lately I have turned it into this and now it works as I wanted, can't we insert partial value from select clause and partial value as a string ?
I am using Node.JS along with the mysql2 module. It's basically like when I try to update a column with a JSON stingified data, I get the following error:
{ Error: You have an error in your SQL syntax; check the manual that corresponds
to your MariaDB server version for the right syntax to use near '"1050":1}WHERE
`user` = ?' at line 1
The stingified JSON data:
{"1050":1}
The query:
var sql = 'UPDATE `users` SET `furniture` = ' + 'concat(furniture,' + JSON.stringify(self.furniture) + ')' + 'WHERE `user` = ?';
self.furniture is related to something else, but I can assure you that self.furniture is returning that JSON data thus I get the mysql syntax error.
sqlMessage: 'You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near \'"1050":
Issue is resolved using backticks along with single quotes.
var sql = 'UPDATE `users` SET `furniture` = ' + `concat(furniture, '${lol}')` + 'WHERE `user` = ?';
var lol = JSON.stringify(self.furniture)
Your query line says in part
...ingify(self.furniture) + ')' + 'WHERE `us...
It should have an extra space after the close parenthesis.
...ingify(self.furniture) + ') ' + 'WHERE `us...
Here's the thing about MySQL syntax errors: the message shows the erroneous query starting with the first character MySQL does not understand. A good way to troubleshoot this kind of thing is to use console.log() to output the entire query string, then look at it carefully. You will usually find something obvious wrong.
I do request to MySQL database, which searches data in table by criteria:
def tableAcounting(){
def user = Person.findByUsername(springSecurityService.currentUser.username)
def cafee = user.cafee
def tablesQuery = TablePlacesInfo.createCriteria()
def tables = tablesQuery.list { //AN ERROR SHOW ON THIS STRING
'in'("hall", HallsZones.findAllByCafee(cafee))
}
def halls = cafee.halls
But I get such error:
Class:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
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
This usually happends if you do an in search using an empty set. This means, that you need to check the size of HallsZones.findAllByCafee(cafee) because this set is probably empty.
WordPress database 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 'LIMIT 1' at line 4
for query
SELECT wp_wpsp_templates_fonts.name
FROM wp_wpsp_templates_fonts
WHERE wp_wpsp_templates_fonts.fontID =
LIMIT 1
made by
require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/twentyten/wpsp-sales-page.php'), require_once('/plugins/wpsp/wpsp-frontend.php'), TemplatesModel->GetFontByID
Below is the code.
function GetFontByID($fontID) {
global $wpdb;
$results = $wpdb->get_results(" SELECT ".$wpdb->prefix."wpsp_templates_fonts.name
FROM ".$wpdb->prefix."wpsp_templates_fonts
WHERE ".$wpdb->prefix."wpsp_templates_fonts.fontID = ".mysql_real_escape_string($fontID)."
LIMIT 1");
return $results[0]->name;
}
Any ideas on how to fix this issue?
GetFontByID() needs a parameter passed to it. Currently, the param appears blank.