This topic is locked

event on export page

5/18/2009 12:10:20 PM
PHPRunner General questions
samsp author

hi there,
i tried to insert the dates from my tabel that i like export in another tabel. this is the code:
// Export page: Before SQL query

function BeforeQueryExport(&$strSQL,&$strWhereClause,&$strOrderBy)

{
// Place event code here.

// Use "Add Action" button to add code snippets.
global $conn,$strTableName,$values;
$strSQL = "INSERT INTO export_einzug (auftrag_lfnr, betrag)

values (";

$strSQL .= $values["lfnr"].",";

$strSQL .= $values["preis"];

$strSQL .= ")";

db_exec($strSQL,$conn);
i get an error " 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 ')'"
my qustion is: how can i insert the dates from the export tabel to another. importend is that the saving starts if the export button is clicked.

samsp author 5/19/2009

hi,
is not possible?
sam

J
Jane 5/19/2009

Hi,
there is no $values array in this event.

You need to select it from your current table:

global $conn,$strTableName;

if ($strWhereClause)

$strSQL = "INSERT INTO export_einzug (auftrag_lfnr, betrag) select lfnr, preis from ".$strTableName." where ".$strWhereClause;

else

$strSQL = "INSERT INTO export_einzug (auftrag_lfnr, betrag) select lfnr, preis from ".$strTableName;
db_exec($strSQL,$conn);

samsp author 5/19/2009

hi jane,
thank you for answering. i've tried that. i got that message:" Table 'gt.export_afendis' doesn't exist." because this is a custom view from 9 differend tables. so the question is how can i get the two colums.
greating
sam

J
Jane 5/19/2009

Sam,
just replace CurrentTable with your actual table name:

if ($strWhereClause)

$strSQL = "INSERT INTO export_einzug (auftrag_lfnr, betrag) select lfnr, preis from CurrentTable where ".$strWhereClause;

else

$strSQL = "INSERT INTO export_einzug (auftrag_lfnr, betrag) select lfnr, preis from CurrentTable";

samsp author 5/19/2009

jane,
the name of the customtable is "export_afendis" but it is a view, not real existing in gt. that's why he could not find a real existing tabel. how should i get the dates.
sam

samsp author 5/20/2009

hi,
how i can get a solution for that problem? i have build in tab datasource tables a view called export_afendis. this is the table i like to export. that is the problem i have reportet above. the export runs, but i could not update the other table. there must be i variable that has the exportet dates. give me a solution.
sam

J
Jane 5/20/2009

Sam,
just replace CurrentTable with your actual table name, not view name.

If it doesn't help publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.