I sent this message to the "general" list yesterday, and have yet to get an
answer (except for that Spanish "Snow White" virus attempt from Peru).

I'm trying to download info from a table as a tab-delimted text file. This
part works fine. (By disabling the UPDATE statement in the code sample
below, I can get the same data file sent time after time.)

I need to keep the data in the table for future reference, and only want to
download each new record once, so I added a DateTime field that gets updated
after downloading. Then searching on that field gives me just the records
that haven't been downloaded yet.

The weird part is that it seems like the LAST MySQL command (UPDATE) gets
executed before the FIRST one (SELECT), because the SELECT statement comes
up with 0 rows.

Here's some selected (modified) parts of the PHP code:

First, I perform the SQL:
SELECT * from db_table WHERE (DownloadedDateTime = '0000-00-00 00:00:00')

Then, it parses and sends the info:
while ($row = mysql_fetch_row($result)) {
    while (list($key, $val) = each($row)) {
       $val = ereg_replace("[\n\r\t]"," ",$val);
       $val = ereg_replace(" {2,}"," ",$val);
       echo $val . "\t";
    //end of line
    echo "\r";

Then I perform the SQL:
(DownloadedDateTime = '0000-00-00 00:00:00')

Any ideas why the rows are getting the DownloadedDateTime field updated
before they get SELECTed?


Don Johnson

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to