Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, November 12, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Bug list  »  Bug #513

Viewing Bug Advanced Details [ Jump to Bugnotes ] [ Bug History ] [ Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000513 core / general feature always 2008-02-21 10:46 2008-02-21 10:46
 
Reporter yyacub View Status public  
Assigned To
Priority normal Resolution open Platform PHP 4.4.8
Status new Duplicate ID OS Linux (v??)
Projection none Version MySQL 4.1.22
ETA none Product Version 5.7.1 (stable)
  Product Build 1.204
  Votes 1
 
Summary MySQL error 1064 with DELETE command and using "key" as the column name in a table
Description >>> SCENARIO <<<

Deleting a record from a table that uses the name "key" as the name of the key column.


>>> THE ERROR <<<

MySQL error 1064
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 'key = 0)' at line 1
Steps To Reproduce use phpMyEdit on a table with "key" as the name of the key column
Additional Information / Solution >>> DETAILS <<<

It was trying to execute:
DELETE FROM vehicles WHERE (key = 0)

but MySQL got all excited about using the name "key" as the column name, sooo just do what the SELECT statement was doing in the same function and add ticks around the table/column names like:
DELETE FROM 'vehicles' WHERE ('key' = 0)

Mimicking the SELECT statement query coding in the same function yields the following:

>>> THE FIX <<<

version: phpMyEdit.class.php,v 1.204
function: do_delete_record()
line: 2777-2778
CHANGE:

$query = 'DELETE FROM '.$this->tb.' WHERE ('.$this->key.' = '
.$this->key_delim.$this->rec.$this->key_delim.')'; // )

TO:

$query = 'DELETE FROM '.$this->sd.$this->tb.$this->ed.' WHERE ('.$this->sd.$this->key.$this->ed.' = '
.$this->key_delim.$this->rec.$this->key_delim.')'; // )


Perhaps there is a more appropriate way to code it, but it worked for me, and that's as far as I have time to take it.
Attached Files

There are no notes attached to this bug.

Bug History
Date Modified Username Field Change
2008-02-21 10:46 yyacub New Bug

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy