Del1 - no table name in query [message #5265] |
Sat, 02 January 2016 06:31 |
htManager
Messages: 433 Registered: May 2014
|
Senior Member |
|
|
I changed tablenames in my database and now I have a problem with a few tables when I want to delete a record. The following error message comes up:
Fatal Error: MySQL: 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 'WHERE user_id='HTM' AND user_seq_no='34' AND rdcaccount_id='4' LIMIT 1' at line 1 (# 1064)
SQL query: SELECT SQL_CALC_FOUND_ROWS * FROM WHERE user_id='HTM' AND user_seq_no='34' AND rdcaccount_id='4' LIMIT 1
I can insert, read and update records in these tables but not delete them. I checked the tasks in the Menu system and if there is the correct tablename in the htm_orga_kontakte(del1).php file. I exported the tables to php once more. I also stepped through the code with the debugger but in the end I didn't recognize where my fault is.
What else can I do to solve this problem? Is there another place/table where I have to change the tablenames? I wonder why I can delete records in some tables and in some tables not.
|
|
|
|
|
Re: Del1 - no table name in query [message #5271 is a reply to message #5269] |
Thu, 07 January 2016 02:48 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
The only way that a simple SQL query such as "SELECT * FROM $this->tablename WHERE ..." will fail with a missing tablename will be because $this->table name is blank. This is set within the constructor of each class and should NEVER be amended in the code.
I suggest you step through a faulty transaction with your debugger to see where it goes wrong.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: Del1 - no table name in query [message #5308 is a reply to message #5307] |
Mon, 18 January 2016 05:37 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
The error messages "Error while sending STATISTICS packet" are produced by the joomla framework and have nothing to do with Radicore.
You need to find out what is happening when std.table.class.inc passes control to dml.mysqli.class.inc. This happens in the _dml_deleteRecord() method which contains the following line of code:
$DML->deleteRecord($this->dbname_server, $this->tablename, $fieldarray);
It is the contents of $this->tablename which is put into the FROM clause of the delete statement, and this should NEVER be blank.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
|
|
|
|
Re: Del1 - no table name in query [message #5335 is a reply to message #5334] |
Sat, 23 January 2016 05:31 |
htManager
Messages: 433 Registered: May 2014
|
Senior Member |
|
|
I found the problem. I have a debugger (xdebug, eclipse mars) but all the time I was worried about menu_user and menu_user_alt in some functions in $this->tablename, when stepping through the code. The problem was a still existing false child-relationship after I changed the primary key of a table. Deleting this relationship lets the code work fine. Thank you.
|
|
|