There are several subordinate forms on the main form. When you change in one of the forms for 1 second, a message appears and disappears. It is not clear to me from the message in which request is this error located?==PDO MESSAGE===
SQLSTATE[42000]: Syntax error or access violation: 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 'WHERE `tabel_id` = '5ed551c1add280b'' at line 1
===SQL===========
UPDATE tabel SET WHERE `tabel_id` = '5ed551c1add280b';
===BACK TRACE====
/var/www/report/nudata.php - line 358 (nuRunQuery)
/var/www/report/nuapi.php - line 52 (nuUpdateDatabase)
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
error nuDebug
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
error nuDebug
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: error nuDebug
I had a similar case just yesterday. I am using a subform that contains a calculated field, but the calculated field itself does not exist in the database table. nuBuilder then generates an invalid UPDATE statement. The solution (or rather workaround) for me was to create the calculated field in the table.
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: error nuDebug
I also think that this is due to the calculated field, but this field exists in my database table. True, the table itself and the calculated field are filled with the php procedure. At what stage to catch the error and fix it?kev1n wrote:I had a similar case just yesterday. I am using a subform that contains a calculated field, but the calculated field itself does not exist in the database table. nuBuilder then generates an invalid UPDATE statement. The solution (or rather workaround) for me was to create the calculated field in the table.
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: error nuDebug
This is a really ugly workaround, to handle the case when the update statement contains 'SET WHERE'
In this file,
https://github.com/steven-copley/nubuil ... a.php#L350
replace the code fragment
In this file,
https://github.com/steven-copley/nubuil ... a.php#L350
replace the code fragment
Code: Select all
if($S != null){
for($i = 0 ; $i < count($S) ; $i++){
$sql = $S[$i];
$insert = "INSERT INTO $nuMainTable";
$length = strlen($insert);
if (strpos($sql, 'SET WHERE') == false) {
nuRunQuery($sql);
if(substr($sql, 0, $length) == $insert and $nuMainID == 'autoid'){
$t = nuRunQuery('SELECT LAST_INSERT_ID()');
$nuMainID = db_fetch_row($t)[0];
}
}
}
}