Jump to content

premora

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

premora's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks. I had another search around and found this website which has now fixed my issue. http://www.kidslovepc.com/php-tutorial/php-mail-bulk.shtml
  2. Hi there everyone. I'm really confused about this as I want to email eveyone in my DB when a new Event is created by a member. I have a test code which I used to make sure it works and it sends to 5 email addresses (which is all of them) in the test table. This works fine. All members with a 0 get the mail. So I now just took the code and changed the table name (obviously!!) and put it in my live site which has 50 members so far. It now doesn't send any emails??? Not sure why this is as the code is exactly the same (except the table name). $result = mysql_query("SELECT email FROM membership WHERE send_as_email = '0'"); while ($row = mysql_fetch_array($result)) { sendMail($row[0]); } mysql_free_result($result); function sendMail($to){ $subject = 'New Event Created; $message = "Hi there,\n Just letting you know of a new Event that has been created.\n Title: $title\n Town: $town\n Date: $date_convert\n For more details or to attend this Event, please login \n Many thanks\n The Team\n \n ****************************************************************************\n THIS EMAIL IS AUTOMATED. DO NOT REPLY.\n To turn notifications off, change the notification settings in your Profile.\n ****************************************************************************\n"; $headers = 'From: members@mysite.co.uk' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); }
  3. Eureka!!! It works. Thank you so much wigwambam for sticking with this, it's appreciated. Huge lesson learnt here so thanks for that and your time too
  4. OK, we are definitely getting there I think. It returned a (1) each for two activities but the issue now is that one of the activities has 2 members so the result should be Activity 1 (2) Activity 2 (1)
  5. Sorry, $row is set in the while loop while ( $row = mysql_fetch_assoc($result) ) { but for the count i'm not using that anyway as $row is used by the name. Instead I have $count = mysql_num_rows($data); $numbers = $count['num'];
  6. Right... I get no error this time but the Members count is empty. $row['name'] is one of the fields from groups2
  7. I get the same error. Is there a completely different way I can do this? I have never used a JOIN before but not sure if this can be used in the same way? The only issue I see that is complicating things is because I want to get only the 1 users details I have to use WHERE L_ID = ". $_SESSION['member_ID'] .";" but the thing is this conflicts with me wanting to know the total number of members in that group as adding to the above SELECT Statement makes only the one users details come up and not everything. Not sure if that was clear...
  8. It's a strange one. If I put your code with the ... or die at the end I get this error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 If I remove the ... or die I still get the previous error What I don't understand from the error above is the first " mentioned is the "Select .... quote on line 32. What is going on??
  9. Sorry, I get the same error but this time it has mysql_num_rows() in it Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource
  10. Hello there, Having a nightmare here. It feels like what I need to do is really easy but I just can't get it to work. I have a table called "groups2" that holds a unique id and the name of an activity. I already have a query that finds the users selected groups using a while loop but I also want to show how many other members are in that group by counting the number of times the activity comes up or the id comes up. I don't know whether I need 2 while loops nested or what but I get the error Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource on line 32 which is highlighted. Can anyone help. I am no expert at php and still learning so some advice or example code would be great. $result = mysql_query("SELECT * FROM groups2 WHERE L_ID = ". $_SESSION['member_ID'] .";"); $data = mysql_query("SELECT COUNT('name') AS num FROM groups2 WHERE name = " . $row['name'] . ""); $count = mysql_fetch_assoc($data); $numbers = $count['num']; while ( $row = mysql_fetch_assoc($result) ) { echo("<tr> <td><font face='Arial, Helvetica, sans-serif' size='3'><strong>" . $row["name"] . "</strong></font></td> </tr><tr> <td><font face='Arial, Helvetica, sans-serif' size='1' color='#0000FF'><strong>Members (" . $numbers . ")</strong></font></td> </tr><tr> <td><hr width=95%><br></td> </tr>"); }
  11. I fully understand what you are saying but the query was fine and all I have done is add your JOIN ON and now it has an error, so I don't understand why there is a query error. Also what count information would be needed in the Members () part as we haven't added a COUNT(*) yet??
  12. Prior to this post I did put 2 while loops in but it gave me 4 results when there are only 2 items in the DB currently. Is there a way to use that instead? I am a basic user when it comes to heavy coding so need some help on this i.e. some example code maybe? Thanks
  13. I get an error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource on line 108
  14. Hi, Thanks for the advice. I haven't used a JOIN before. How would I code that in a while loop to get the results?
  15. Hi there, Having an issue here. I have a site where you can join a group. When the user goes to the groups page it will list their groups that they have joined. This is fine. I also want to be able to show how many other members are in that group and am getting stuck. $row group_name works ok but not sure how to start by adding another while loop in for the members. The table consists of group id, group name, member id (L_ID) and member name $result = mysql_query("SELECT * FROM groups2 WHERE L_ID = ". $_SESSION['member_ID'] .";"); while ( $row = mysql_fetch_array($result) ) { echo("<tr> <td><font face='Arial, Helvetica, sans-serif' size='3'><strong>" . $row["group_name"] . "</strong></font></td> </tr><tr> <td><font face='Arial, Helvetica, sans-serif' size='1' color='#0000FF'><strong>Members ("???")</strong></font></td> </tr><tr> <td><hr width=95%><br></td> </tr>"); }
×
×
  • 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.