[phplib] please help! using the db_xxx.inc classes From: Peter Bowyer (reywob <email protected>)
Date: 12/10/00

Hi,

I have the following code

----
<?php
include ("./sendcard_setup.php");
include ("./include/".$dbfile);
include ("./functions.php");

$time = time(); $time = $time + 43200; // sends any cards which will be sent in the next 6 hours $sql = "SELECT * from $tbl_name where id < $time AND emailsent = 0";

$db = New DB_Sendcard; $db->query($sql);

while($db->next_record()) { $to = $db->f("towho"); $to_email = $db->f("to_email"); $from = $db->f("fromwho"); $from_email = $db->f("from_email"); $id = $db->f("id");

include("sendcard_setup.php"); mail ("$to_email", "$youhavecard_subject", "$youhavecard", "From: $from_email");

$query = "UPDATE $tbl_name SET emailsent = '1' where id = ".$id; $db->query($query); }

?>

My problem is caused by the second database query, as it destroys the while loop. At least I think that's the problem, as it only sends the first email. How can I cure this problem?

TIA, Peter.

---oOo--- Do you sendcard? http://www.sendcard.f2s.com/ PHP postcard script supporting 9 databases! ---oOo---

--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>