Jump to content

premora

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Everything posted by premora

  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>"); }
  16. Thanks. Any ideas if this is going to be completely complicated or a short bit of code to get the data? I've not used AJAX before so wondered if anyone knew as this may take a while otherwise.
  17. Hello all. I have an ID Messaging system where the user puts in the ID of the user they want to contact and it sends a message to their Inbox - Great. What I need is a feature where the user puts in the ID and onblur another textbox populates with the users Name from the MySQL Database without having to reload the page so they know they have the right person. I am pretty new to this so have no idea where to start with this population feature. Here's my form code. Hope someone can help. <table width="450" border="0"> <tr> <td> <form name="messages" method="post" action="inbox_messages_send.php" onsubmit="return checkform(this);"> <table width="411" height="227" border="0"> <tr> <td align="right" bgcolor="#EAEAEA"><font size="2" face="Arial, Helvetica, sans-serif">From:</font></td> <td bgcolor="#EAEAEA"><input type="hidden" name="sentBy" size="3" maxlength="3" align="absmiddle" value="<?php echo $_SESSION['member_ID']; ?>"> <input type="hidden" name="fname" value="<?php print email('name'); ?>"><input type="hidden" name="lname" value="<?php print email('lname'); ?>"> <font size="1" face="Arial, Helvetica, sans-serif">(Your ID is automatically attached)</font></td> </tr> <tr> <td align="right" bgcolor="#EAEAEA"><font size="2" face="Arial, Helvetica, sans-serif">To:</font></td> <td bgcolor="#EAEAEA"><input type="text" name="L_ID" size="3" maxlength="3" align="absmiddle"> <font size="1" face="Arial, Helvetica, sans-serif">(Member's ID)</font></td> </tr> <tr> <td align="right" bgcolor="#EAEAEA"><font size="2" face="Arial, Helvetica, sans-serif">Subject:</font></td> <td bgcolor="#EAEAEA"><input type="text" name="subject"></td> </tr> <tr> <td align="right" bgcolor="#EAEAEA"><font size="2" face="Arial, Helvetica, sans-serif">Message:</font></td> <td bgcolor="#EAEAEA"><textarea cols="35" rows="5" name="email_message"></textarea></td> </tr> <tr> <td align="right"> </td> <td><input type="submit" name="message" value="Send Message"></td> </tr> </table> </form></td> </tr> </table>
  18. What a Star - That's got it. Thanks so much
  19. Now I get the error: Parse error: syntax error, unexpected ')', expecting ',' or ';' in
  20. tried that but it still gives the same error so I removed it again
  21. Hello, I am struggling here with a T_IF error. The IF Statement is inside a WHILE Loop and I have been searching for the dreaded missing ;'s that normally make these errors. Please help. The error line is in RED Here's the code: while ( $row = mysql_fetch_array($result) ) { echo("<table width='750' height='165' border='0' bgcolor='#DDDEFF' align='center'> <tr> <td width='107' height='30' align='center' bgcolor='#B73230'><b><font size='2' face='Arial, Helvetica, sans-serif' color='FFFFFF'>" . $row["name"] . "<br>ID: " . $row["L_ID"] . "</font></b></td> <td colspan='7' bgcolor='#2B2FE3' align='center'><img src='images/arrows.jpg'></td> </tr> <tr><td rowspan='4' valign='top'><div align=center><img src=images/avatar/".$row["L_ID"] ."s.jpg></div></td> <td width='10' rowspan='3'> </td> <td width='43' height='30'><b>Event: </b></td> <td width='100'><font size='2' face='Arial, Helvetica, sans-serif'>" . $row["title"] . "</font></td> <td width='10' rowspan='3'> </td> <td align='right'><b>Location: </b></td> <td width='160'><font size='2' face='Arial, Helvetica, sans-serif'>" . $row["location"] . "</font></td> <td width='170' align='center'><img src='images/titleAttendingEvents.jpg'></td> </tr> <td align='right' height='30'><b>Date: </b></td> <td><font size='2' face='Arial, Helvetica, sans-serif'>" . date('d/m/Y', strtotime($row['event_date'])) ."</font></td> <td align='right'><b>Post Code: </b></td> <td><font size='2' face='Arial, Helvetica, sans-serif'>" . $row["postCode"] . "</font></td> <td width='170' align='center'><font size='4'>" . $row["attend"] . "</font></td> </tr> <tr> <td align='right' height='30'><b>Time: </b></td> <td height='30'><font size='2' face='Arial, Helvetica, sans-serif'>" . $row["time"] . "</font></td> <td align='right'><form name='email_host' method='post' action='email_host.php'><input type='hidden' name='id' value='" . $row["L_ID"] . "'><input type='hidden' name='title' value='" . $row["title"] . "'><input type='image' src='images/icons/email_s.jpg' align='absmiddle' height='30' alt='Email Host'><b><font size='2' face='Arial, Helvetica, sans-serif'> Email </b></font></form></td> <td align='center'><form name='attending' method='post' action='attend_send.php'><input type='hidden' name='id' value='" . $row["id"] . "'><input type='submit' name='attend_event' value='Attend Event'></form></td> <td width='170' align='center'><img src='images/icons_group.jpg'></td> </tr> <tr>" if ($row['cancel'] == 1) { echo "<td colspan='4' height='30' align='center'><font size='3' face='Arial, Helvetica, sans-serif' color='red'><b>CANCELLED</b></font</td>"; } else { echo "<td colspan='4' height='30'> </td>"; } echo " <td align='center' height='30'><form name='myForm' method='post' action='event_details.php'><input type='hidden' name='event_id' value='" . $row["id"] . "'><input type='image' src='images/btn_event_details.jpg' align='absmiddle' height='30' alt='View Full Event Details'></form></td> </tr> </table> <br>"); }
  22. Excellent - That got it. Really appreciate your time and thanks again.
  23. I tried adding the echo anyway and I still get the same error on that line: $pic = 'images/avatar/'.$row["L_ID"] .'s.jpg';
  24. Hi Crayon, Isn't the echo at the top covering this part of the code? I have just slotted in between the If statement. The first resolution returned the same error
  25. Hello all, I am a real newby to this but need some help with a file_exists / while loop issue i have. I am trying to show a table of pictures (with their own ID's) but also if someone hasn't uploaded a picture to the server a default picture will be shown instead. I get the error: Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/thefrien/public_html/members1.php on line 103 Here is my code: $i = 1; echo "<table border='1' align='center'><tr>"; $result = mysql_query( "SELECT * FROM membership order by L_ID asc" ); while ( $row = mysql_fetch_assoc( $result ) ) { echo "<td align='center' bgcolor='#DDDEFF'><a href='profile_view.php?L_ID=".$row["L_ID"] ."'>" $pic = 'images/avatar/'. $row["L_ID"] .'s.jpg'; if (file_exists($pic)) { echo '<img src=http://www.thefriendzconnection.co.uk/images/avatar/'.$row["L_ID"] ."s.jpg>"; } else { echo '<img src=http://www.thefriendzconnection.co.uk/images/0s.jpg border='0'>'; } "</a> <br><font size='1' face='Arial, Helvetica, sans-serif'>".$row["name"] ."</font> <br><font size='1' face='Arial, Helvetica, sans-serif'>ID: ".$row["L_ID"] ."</font> <br> </td>"; if ( $i % 6 == 0 ) { echo "</tr><tr>"; } $i++; } mysql_free_result( $result ); echo "</tr></table>"; The line I am having issues with seems to be: $pic = 'images/avatar/'. $row["L_ID"] .'s.jpg'; Any suggestions would be greatfully received Thanks.
×
×
  • 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.