Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. nope, as long $name is an array.
  2. Below is the current script and it is only sending the message to the last email in the database and skips the rest... <?php session_start(); //allow sessions include("config.php"); //get database information if(!$_POST[send]){ //if the form was not submitted echo "<form action='' method='post' > <table width='600' border='0' cellspacing='0' cellpadding='0' align='left'> <tr> <td height='35' colspan='2' align='left'><b>Send a email to all users</b></td> </tr> <tr> <td height='35' align='left'><b>Subject:</b></td> <td width='515' align='left'><input type='text' name='title' id='title' size='30' /></td> </tr> <tr> <td width='85' height='150' align='left' valign='top'><b>Message:</b></td> <td align='left' valign='top'><textarea name='msg' id='msg' cols='65' rows='9'></textarea></td> </tr> <tr> <td height='35'> </td> <td><input type='submit' name='send' id='send' value='Send' /></td> </tr> </table> </form>"; //return with the form }else{ //or if it was $supportEmail = 'support@mysite.com'; $title = strip_tags(htmlspecialchars($_POST[title])); $date = date("F j, Y, g:i a"); $values = array(); $message = stripslashes($_POST[msg]); //message $getusers = mysql_query("SELECT * FROM user"); $getemail = "SELECT email FROM user"; $result = mysql_query($getemail); $to=$row['email']; $link="<a href=\"http://mysite.com/contact.php\">Click here</a>"; if(empty($message)){ echo "<a href=\"history.go(-1)\">Go Back</a>You Can Not Send An Empty Message!"; }else{ while ($row = mysql_fetch_array($result)){ $email = $row['email']; //send email } $body = <<<EOD <br><hr><br> =============================== <br> <br> Subject: $title <br> Message: $message <br><br> This message has been sent by My Site. Do not reply to this email. $link to contact support. <br> =============================== <br><br> EOD; $headers = "From: $supportEmail\r\n"; $headers .= "Content-type: text/html\r\n"; $send_contact = mail($email,$title,$body,$headers); // Check, if message sent to your email if($send_contact){ echo "<script language='javascript'> alert('Your site wide email has been sent.'); window.location.href = 'http://mysite.com/x9y6uw5e8_/admin_panel.php?page=mass_email'; </script>"; } } //end check for empty message } //end form check ?> it only sends to one email because you keep overwriting the $email variable. Did you read my post. you should either store each email in an array, and use a foreach to loop through each email, and email each person, or concatenate each email to one to string. while($row = mysql_fetch_array($query)){ $email = $row['email']; send = mail($email,$title,$body,$headers); } obviously you would have to define the headers and body and stuff before you send them email
  3. There is a link in my sig that has a beginning tutorial on arrays. If you read that, and then read the next tutorial after it, you should have a much better idea of what to do. But in short, $each is the value that each iteration through the array will have. so if the array is john charly david etc. then the first run of the loop, $each will have "John" second run, it will have "Charly" etc.
  4. as the error message says, that directory doesn't have the correct file permissions. You will need to give whatever directory that script is in the correct file permissions
  5. well whatever value that variable is supposed to have, you set the variable before you call the function $sel_subject = "whatever"; Perhaps you should read up on more basic tutorials
  6. so then send each email in the while loop? or append the to field so its like email1, emial2, email2, etc
  7. you would want to make the $name variable into an array, IE $name = array("john", "doug", "Phil"); and then you could use a foreach loop foreach ($name as $each){ if ($each == $databasename){ //do whatever } else { //do whatever else } }
  8. you define it like any other variable?
  9. $query = "SELECT email FROM users"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)){ $email = $row['email']; //send email } ?
  10. Im not quite sure what you mean. Can you expain a little better? what does it do to search the data base? what are you auto incrementing? some code examples (even pseudo code) would help
  11. if you want to push the arrays into the new array, you can just do something like $array[] = $otherArray; //or $array[] = array("stuff", "in", "other", "array"); However, look into array_merge as Jay said if you want to merge the arrays
  12. <?php navigation($sel_subject, $sel_page); ?> You have to define $sel_subject in this line. You aren't defining it any where I can see
  13. <? $Campus1['Course1'] = 5; $Campus1['Course2'] = 15; $Campus1['Course3'] = 22; $Campus1['Course4'] = 21; $Campus1['Course5'] = 12; $Campus1['Course6'] = 25; $Campus1['Course7'] = 16; $Campus1['Course8'] = 11; $Campus1['Course9'] = 17; $Campus1['Course10'] = 23; $Campus = array($Campus1, $Campus2, $Campus3); $Campus[0];//this is campus one. //to access the first course, you do $Campus[0]['Course1'] = 11; //remember, since $Campus[0] is $Campus1, you can treat $Campus1['Course1'] and $Campus[0] the same
  14. $query = "SELECT name from table"; while ($row = mysql_fetch_array($query)){ echo "<option value=\"".$row['name']."\" >."$row['name']."</option>"; } you would obviously have to substitute name with whatever the column name is and table with your table, and of course add a where condition or whatever else.
  15. you need to post the code you left it, because $w==$x doesn't make any sense. From what i have seen, you don't update either variable, and if they are not equal that loop will never run, and if they are equal the loop will be infinite
  16. By the way, session_register is deprecated. as long as you have session_start() at the beginning of your page you can just do $_SESSION['username'] = $whatever; and that would register the session, and you can use the data later. I would just set an email session when your user logs in so you can use that instead of doing another query.
  17. well each row is its own array. each cell is the course number. so the first store would look like $store1['Course1'] = 54; $store1['Course2'] = 23; $store1['Course3'] = 56; each of the stores (which are arrays) are stored in another array, so the array that holds everything is basically an array of arrays $Stores = array($store1, $store2); To access the first store, you would access the first element of the array, like so $Stores[0];//this is store one well, because its an array, you can treat it like one, if you wanted to, say, access the numer of students in the first course, you would do the following $Stores[0][0];//54 Check out this tutorial for more information: HERE
  18. well, the only way I see you can do is to send an email for each person (IE select every row in the data base and get the email) or you can try sending to them all with 1 email, but regardless, you have to go through your entire table. I would suggest just trying to send 1 email, and just concatenating each email to the to: string (like, user1@email, user2@email). make sure if you do that that you adhere to the RFC standard. But even if you do that, your mail server is still going to have to send 80k+ emails.
  19. you have to put the LIMIT at the end of the query. IE $query = mysql_query("SELECT * FROM test WHERE id NOT IN (SELECT id FROM test1) ORDER BY datetime DESC LIMIT $VarCount ") or die(mysql_error());
  20. concatenate a string. $products = ""; foreach($_POST['product'] as $product) { $products .= $products . " "; } that will put your products in a line with each one seperated by a space, IE shirt pants dog cat sandwhich. you could then use the $products variable in your body
  21. you know we have an AJAX forums here right?
  22. you need to surround your PHP code with PHP tags (<?php ?>) which line is line 80? repost updated code plz
  23. echo the mysql_error() and see what it is. im assuming your coded gives you the failed message?
  24. please post the relevant code (IE the code that is causing the problem. Would probably be the query and processing code) I dont want to wade through lines of CSS and HTML to just view the code
  25. http://www.php.net/manual/en/language.oop5.late-static-bindings.php Example #4 Ahh ok thanks, i didn't see anything on the static keyword page, so I wasn't sure.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.