Loading...
 

DAL method: QueryAll()

Selects all records from the table.
Syntax
QueryAll()
Arguments
No arguments.
Return value
Returns the recordset on success or FALSE on error.
Example
Send mass email to all users:
PHP
global $dal;
//select emails from Users table
$tblUsers = $dal->Table("UsersTableName");
$rs = $tblUsers->QueryAll();
while ($data = db_fetch_array($rs))
{
  $email.=$data["EmailAddress"].", ";
  $from="admin@test.com";
  $msg="Check what's hot this season";
  $subject="Monthly newsletter";
  $ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));
  if(!$ret["mailed"])
    echo $ret["message"]."<br>";
}
ASP
Response.Flush
set data = dal.Table("users").QueryAll()
while not data.eof
   ' send the email
   rmail("to")=data("email")
   rmail("subject")="Sample subject"
   rmail("body")="Sample body"
   set result = runner_mail(rmail)
   ' if error happened print a message on the web page
   if not result("mailed") then
      response.write result("message") & "<br>"
      response.flush
   end if
   data.MoveNext
wend
data.close: data=nothing

See also