Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8719325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:46:03+00:00 2026-06-13T06:46:03+00:00

I enjoy learning and doing things on my own, but I have run into

  • 0

I enjoy learning and doing things on my own, but I have run into a pickle that I don’t know how to fix.

I am trying to write a php mass mailer for an announcement system that I can activate within an admin page via a button.

Here is what the current script looks like.

function sendStreamAnnounce(){
  global $database, $session, $mailer, $form;      
    $q = "SELECT username,email"
        ."FROM ".TBL_USERS."";
    $result = $database->query($q);
    $num_rows = mysql_numrows($result);

   for($i=0; $i<$num_rows; $i++){
    $email  = mysql_result($result,$i,"email");

     /* Attempt to send the email with new password */
     if($mailer->sendStreamAnnounce($email))
    $_SESSION['mailed'] = true;
          else{
    $_SESSION['forgotpass'] = false;

     }
      header("Location: ".$session->referrer);
    }
}

The current set up leaves me with this

http://puu.sh/1gkgg.jpg

I’ve somehow adapted this from a “I forgot my password” php script that came with a tutorial-esque backend I am using. I realize some things like “$_SESSION” probably aren’t needed.

Any help is welcomed! I know many people don’t like spoonfeeding, so hints would help me a ton too.

Thank you guys in advance!

Edit: I fixed it on my own / with Arun’s help!

 function sendStreamNotice(){
  global $database, $session, $mailer, $form;      
    $q = "SELECT username,email "
        ."FROM ".TBL_USERS."";
    $result = $database->query($q);
    $num_rows = mysql_num_rows($result);
  if(!$result || ($num_rows < 0)){
  echo "Error displaying info";
  return;
}
  if($num_rows == 0){
  echo "Database table empty";
  return;
}

for($i=0; $i<$num_rows; $i++){
    $email  = mysql_result($result,$i,"email");
    $user = mysql_result($result,$i,"username");

     /* Attempt to send the email with new password */
     if($mailer->sendStreamNotice($user,$email))
    $_SESSION['mailed'] = true;
          else{
    $_SESSION['forgotpass'] = false;

     }
      header("Location: ".$session->referrer);
    }
}

The email went through just fine!

http://puu.sh/1gkRx.jpg

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:46:05+00:00Added an answer on June 13, 2026 at 6:46 am

    use $num_rows = mysql_num_rows($result); instead of mysql_numrows($result);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to start learning OpenGL but I don't really want to have to
I enjoy running custom scripts on pages that I do not own or control.
Something I don't enjoy about programming is learning a new API. For example, right
I enjoy GWT because I can have compile-time type safe code that runs in
I have a question regarding this code. I'm a beginner and enjoy learning C#.
I'm a complete Xcode/Objective-C/Cocoa newbie but I'm learning fast and really starting to enjoy
I have a rails app that I enjoy developing on a sever much more
I really enjoy using upstart. I currently have upstart jobs to run different gunicorn
I seem to enjoy designing new UIViews and UIControls that implement their own -drawRect:
I found a wordpress theme that I really enjoy, however, I already have all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.