This topic is locked

Cannot stop While Loop

3/19/2015 8:42:22 PM
PHPRunner General questions
A
Anapolis author

[size="3"]I need to update a table with all of the records from the List page of another table.
I am using BEFORE EXPORT RECORD Event.
This Does Work.
All of those records are inserted into my table perfectly with the code below but This LOOP WILL NOT STOP.

It keeps looping over and over through those records and the Exported CSV file never is presented.
Here is the abbreviated code I am using in the BEFORE EXPORT RECORD EVENT.
THIS CODE Inserts hundreds of records in a couple of seconds when I press the EXPORT button after choosing All records and CSV.

Unfortunately it runs on forever and the CSV file is never downloaded.


[/size]


global $conn;

while ($data = db_fetch_array($rs)) {
$strSQLInsert ="INSERT IGNORE INTO faxlist_table(appt_id,trainingdate,beginn,apotheke,kdnr,strasse,plz,ort,faxnr,trainername,faxstatus,faxlist_time)

Values('". mysqli_real_escape_string($conn, $data["appt_id"]) ."',

'".mysqli_real_escape_string($conn, $data["trainingdate"])."',

'".mysqli_real_escape_string($conn, $data["beginn"])."',

'".mysqli_real_escape_string($conn, $data["apotheke"])."',

'".mysqli_real_escape_string($conn, $data["kdnr"])."',

'".mysqli_real_escape_string($conn, $data["strasse"])."',

'".mysqli_real_escape_string($conn, $data["plz"])."',

'".mysqli_real_escape_string($conn, $data["ort"])."',

'".mysqli_real_escape_string($conn, $data["faxnr"])."',

'".mysqli_real_escape_string($conn, $data["trainername"])."',

'".mysqli_real_escape_string($conn, $data["faxstatus"])."',

'".mysqli_real_escape_string($conn,$data["faxlist_time"])."')";

CustomQuery($strSQLInsert);

}
return true;


[size="3"]

My table gets hundreds of records inserted but the loop never stops & I never get my CSV file. I have tried all kinds of different "solutions" but nothing stops the loop while Saving a CSV export AND Inserting those records into a table.
If you have suggestions I am ready to hear them.
I figure it has to do with the WHILE statement.
Thanks for your help.

[/size]

<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=23052&image=1&table=forumtopics' class='bbc_emoticon' alt=':huh:' />