Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Transaction Patterns » Del1 - no table name in query
Del1 - no table name in query [message #5265] Sat, 02 January 2016 06:31 Go to next message
htManager is currently offline  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 #5266 is a reply to message #5265] Mon, 04 January 2016 02:46 Go to previous messageGo to next message
AJM is currently online  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
After changing the tablenames did you create class files for the new tables and delete the old ones?

Re: Del1 - no table name in query [message #5269 is a reply to message #5266] Wed, 06 January 2016 05:30 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
Yes, I did. I also exported all the tables to PHP. The DEL pattern is working fine with most of the tables. I have only problems with a few ones.

Shall I try to delete the php file and the database task entries for the del pattern and create it once more?
Re: Del1 - no table name in query [message #5271 is a reply to message #5269] Thu, 07 January 2016 02:48 Go to previous messageGo to next message
AJM is currently online  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.


Re: Del1 - no table name in query [message #5307 is a reply to message #5271] Mon, 18 January 2016 03:11 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
Hi Tony,

I set up the latest xampp environment with the latest radicore version 1.92.00 to be sure not to have an outdated environment. But I get the same errors.
I stepped through the debugger and set an breaking point in the dml.mysqli.class.inc at line 461. I get these error messages shown in the atached picture. I don't know how to handle it. You said that the sql_from variable must be filled. It seems that it is. But what say all the other error messages? I have no clue what to do next to get the error isolated.

Best regards, Juergen
  • Attachment: htm01.png
    (Size: 406.49KB, Downloaded 1318 times)
Re: Del1 - no table name in query [message #5308 is a reply to message #5307] Mon, 18 January 2016 05:37 Go to previous messageGo to next message
AJM is currently online  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.


Re: Del1 - no table name in query [message #5327 is a reply to message #5308] Tue, 19 January 2016 10:09 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
When the code comes to _dml_deleteRecord() in std.tbl.class.inc the error message is already visible. The value of dbname in $this is audit. Can it be that something goes wrong when trying to insert the deleted records in the audit tables?
Re: Del1 - no table name in query [message #5328 is a reply to message #5327] Wed, 20 January 2016 05:22 Go to previous messageGo to next message
AJM is currently online  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
You need to step through with your debugger to see where this error message is being generated, and to look at the value of $this->tablename at this point. $this->tablename is set in the class constructor and should NEVER be changed. The problem lies in your code, not the framework.

Re: Del1 - no table name in query [message #5329 is a reply to message #5328] Thu, 21 January 2016 04:50 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
The error shows up in the logon.class.inc after line 27 // perform any custom logon processing. The updatearray contains the content of the record which should be deleted but the tablename is menu. Can it be that something goes wrong with the audit_logging? Can I disable the logging to see if that is the problem?
  • Attachment: Del Logon.png
    (Size: 194.38KB, Downloaded 1046 times)
Re: Del1 - no table name in query [message #5330 is a reply to message #5329] Thu, 21 January 2016 05:09 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
I turned auto_logging to 'No' for the org_kontakte_adresse table in data dictionary, exported to PHP but with no success. The error message is still the same.
Re: Del1 - no table name in query [message #5334 is a reply to message #5330] Fri, 22 January 2016 05:35 Go to previous messageGo to next message
AJM is currently online  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
You need to step through the execution of the code with a debugger so that you can see exactly where the contents of either $this->tablename or $this->sql_from is being corrupted. If you don't have a debugger then you should get one ASAP.

Re: Del1 - no table name in query [message #5335 is a reply to message #5334] Sat, 23 January 2016 05:31 Go to previous message
htManager is currently offline  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.
Previous Topic: PopUp and add1 - key fields
Next Topic: add1 in shared account
Goto Forum:
  


Current Time: Thu Nov 21 04:31:04 EST 2024

Total time taken to generate the page: 0.03523 seconds