M
mfriend author
Hi Folks: I am pretty new to Phprunner. I am trying to use the following SQL code to copy new records from one table to another.
The original table is: stackyard_storage. In the Before Record Added event section and the Before Record Added event section I added the following code: //** Save new data in another table **** global $conn,$strTableName;
$strSQLSave = "INSERT INTO stackyard_movement (STACKYARD_STORAGE_ID, HARVEST_ID, STACKYARD, BALES, DATE_MOVED, DISTRIBUTION_TYPE, DESTINATION, NUMBER_BALES) values (";
$strSQLSave .= $values["STACKYARD_STORAGE_ID"].",";
$strSQLSave .= $values["HARVEST_ID"].",";
$strSQLSave .= $values["STACKYARD"].",";
$strSQLSave .= $values["BALES"].",";
$strSQLSave .= $values["DATE_MOVED"].",";
$strSQLSave .= $values["DESTINATION"].",";
$strSQLSave .= $values["NUMBER_BALES"];
$strSQLSave .= ")";
db_exec($strSQLSave,$conn); // Place event code here.
// Use "Add Action" button to add code snippets. return true; I need new data to be copied from the stackyard_storage table to the stackyard_movement table. Both tables are exactly the same (fields are the same. They are a copy of one another except I removed the foreign keys on the storage_movement table. I very much appreciate any help. The error is below. Thank you,
Matthew The error reads: php error happened
Technical information
Error type 256
Error description 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 ',23C/C,33,2013-05-16 00:00:00,sdfsdf,22)' at line 1
URL localhost/stackyard_storage_add.php?ferror=1&
Error file D:\phprunner_projects\Farm Data\output\include\dbconnection.my.mysqli.php
Error line 42
SQL query INSERT INTO stackyard_movement (STACKYARD_STORAGE_ID, HARVEST_ID, STACKYARD, BALES, DATE_MOVED, DISTRIBUTION_TYPE, DESTINATION, NUMBER_BALES) values (,,23C/C,33,2013-05-16 00:00:00,sdfsdf,22) More info Call stack
File: line Function Arguments
0. include\dbconnection.my.mysqli.php:42 trigger_error 1. 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 ',23C/C,33,2013-05-16 00:00:00,sdfsdf,22)' at line 1;
- 256;
1. include\dbconnection.my.mysqli.php:42 db_query 1. INSERT INTO stackyard_movement (STACKYARD_STORAGE_ID, HARVEST_ID, STACKYARD, BALES, DATE_MOVED, DISTRIBUTION_TYPE, DESTINATION, NUMBER_BALES) values (,,23C/C,33,2013-05-16 00:00:00,sdfsdf,22);
- mysqli;
2. include\dbconnection.my.mysqli.php:53 db_exec 1. INSERT INTO stackyard_movement (STACKYARD_STORAGE_ID, HARVEST_ID, STACKYARD, BALES, DATE_MOVED, DISTRIBUTION_TYPE, DESTINATION, NUMBER_BALES) values (,,23C/C,33,2013-05-16 00:00:00,sdfsdf,22);
- mysqli;
3. include\stackyard_storage_events.php:50 eventclass_stackyard_storage->BeforeAdd 1. Array ( [STACKYARD] => 23C/C [BALES] => 33 [DATE_MOVED] => 2013-05-16 00:00:00 [DISTRIBUTION_TYPE] => dsfsd [DESTINATION] => sdfsdf [NUMBER_BALES] => 22 ) ;
- ;
- ;
- AddPage;
4. stackyard_storage_add.php:304 Global scope N/A
---------------------------
Edit: Thought I would add more info: the database is MySQL 5.5.31
PHP: 5.3.24.0-r2-win32-vc9-standard-fcgi
Apache: 2.2.24 Database/php/and phprunner are on the same computer (Windows 7 Pro) running as localhost.
|
|