> -----Oprindelig meddelelse-----
> Fra: Mike Hall [mailto:[EMAIL PROTECTED]]
> Sendt: 28. april 2002 12:28
> Til: [EMAIL PROTECTED]
> Emne: Fw: WHERE ignored
>
>
> Corrupt index, hmm? I'll check that in a moment - thanks.

After looking at your fault-free script, my best bet would also be a
corrupted index. Do you have myisamchk scheduled to run periodically (eg.
just after 09.00)? Because that would explain, why the error only occurs
once. Consider this scenario

08.55: The mailscript runs fine
Between 08.55 and 09.00: Something corrupts the index (perhaps the script
running af 08.55?)
09.00: The mailscript runs, but because of the faulty index, you send to
many mails
09.02: myisamchk is run and automatically repairs the index.
09.05: The mailscript runs fine

It might sound a bit far off, but I don't know your setup :-)

> Probably a sensible idea to limit the query too - I think I'll
> order by date
> desc too just to make sure that recent mail gets sent.

Don't limit the query, instead do a conditional check in php, eg.

if ($db->recordcount > 100) {
  // send mail to yourself that something is wrong, log the number of
records and immediately do an extra query: EXPLAIN SELECT MailID, MailFrom,
MailTo, Subject, Body, Headers FROM
Mail WHERE Sent = 0
  // Write the EXPLAIN result to a logfile.
  exit;
}

This way you're able to diagnose the error when it hits again, which it
probably will.

Ask yourself, what could have caused a corrupt index? Power glitch?

- Carsten


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to