I have a customer emailer that is timing out. so, I want to put the query into a array and work from it to push out emails. However,
all the code is in, what I call, shorthand and I've not found a good resource to help me 'get' this fully.
Here is the opening, where the (trimmed) query starts:
$db->query("SELECT * FROM email_list WHERE newsletters='Yes';
while($db->movenext()){
send_mail($db->col["email"], $subject, $content_html, $from_name." <".$from_email.">", "html");
$uc++;
}
---------------------
'query' is a function:
function query($_query){
list($usec, $sec) = explode(" ",microtime());
$time_start = ((float)$usec + (float)$sec);
$this->query = $_query;
$this->result = @mysql_query($_query, $this->link_id) or die("<b>error in sql query</b><br><pre>".$_query."</pre>.mysql error : <b>".mysql_error($this->link_id)."</b><p>");
list($usec, $sec) = explode(" ",microtime());
$time_end = ((float)$usec + (float)$sec);
$time = $time_end - $time_start;
}
---------------------------
I'm thinking that I can make a version of the query function that returns an array, or is it that $db is already an array? Or, does $this->result actually mean 'foreach ($query->result() as $row)'?
Or, can I put 'foreach ($query->result() as $row)', or something like it in the opening portion of this? Ugh, I'm so clueless.
Again, I'm dealing with timeouts and basically want to get the mysql results as quickly as possible and process the code afterwards.
Thanks!