runnerjp
Members-
Posts
2,214 -
Joined
-
Last visited
Everything posted by runnerjp
-
Perhaps the e-mail is wrong. -- thought that at 1st and its correct Perhaps you should wait a bit longer. -- i did it yesterday lol Check your junk.-- empty Try a different e-mail address. /-- yup done and no success lol thanks for trying.... any1 else know?
-
nope adly that didnt work either... its wierd as ud thought that it would echo MAIL FAILED FOR $email ...
-
changed ti to <?php $query = "SELECT fe.*, u.email, u.ID FROM forum_email as fe INNER JOIN users as u ON u.ID = fe.user_id"; $res = mysql_query($query) or die ("$query fails : ".mysql_error()); //$row = mysql_fetch_assoc($res); //var_dump($row); //echo $forumpostid; echo $id; //nobody wants an email, stop now if(mysql_num_rows($res)==0) { echo "no records returned"; exit; } // ADDED CODE TO SEND EMAIL MESSAGES $subj = 'Forum Updated'; $from = 'admin@runningprofiles.com'; $text = ' [your message text] '; while ($row = mysql_fetch_assoc($res)) { extract ($row); if (!mail($email, $subj, $text, $from)) { echo "<br />MAIL FAILED FOR $email \n"; } }?> didnt work sadly
-
doh that might help.. forgot to add that... prob cos im more frustrated that i cant get the emails to send lol
-
ok i have my code below that checks to see if a user wants to recive emails about new posts on a topic... <?php $query = "SELECT fe.*, u.email, u.ID FROM forum_email as fe INNER JOIN users as u ON u.ID = fe.user_id WHERE fe.topic_id = " . $forumpostid . " AND fe.mailed=1"; $res = mysql_query($query) or die ("$query fails : ".mysql_error()); //$row = mysql_fetch_assoc($res); //var_dump($row); //echo $forumpostid; echo $id; //nobody wants an email, stop now if(mysql_num_rows($res)==0) { echo "no records returned"; exit; } // ADDED CODE TO SEND EMAIL MESSAGES $subj = 'Forum Updated'; $from = ' [your return information ] '; $text = ' [your message text] '; while ($row = mysql_fetch_assoc($res)) { extract ($row); if (!mail($email, $subj, $text, $from)) { echo "<br />MAIL FAILED FOR $email \n"; } } //set emailed to 'y' so that they don't get numerous emails... set it back to 'n' when they view this topic $query_noted = "UPDATE forum_email SET mailed='0' WHERE topic_id = '".$forumtopicid."'";?> but my emails are not been sent and $query_noted is'nt updating the mailed field... i var_dunm($row) and got array(5) { ["user_id"]=> string(1) "1" ["topic_id"]=> string(3) "484" ["mailed"]=> string(1) "1" ["email"]=> string(25) "admin@runningprofiles.com" ["ID"]=> string(1) "1" } so its getting the data ... any 1 figure out why
-
ok i think i would need to do this <?php $query = "SELECT fe.*, u.email, u.ID FROM forum_email as fe INNER JOIN users as u ON u.ID = fe.user_id WHERE fe.topic_id = " . $forumpostid . " AND fe.mailed=1"; $res = @mysql_query($query) or die ("sendNotification query fails :".mysql_error()); echo $forumpostid; echo $id; //nobody wants an email, stop now if(mysql_num_rows($res)==0) { echo "no records returned"; exit; } // ADDED CODE TO SEND EMAIL MESSAGES $subj = 'Forum Updated'; $from = ' [your return information ] '; $text = ' [your message text] '; while ($row = mysql_fetch_assoc($res)) { extract ($row); if (!mail($email, $subj, $text, $from)) { echo "<br />MAIL FAILED FOR $email \n"; } }?> $email --- houw would i get each users email form the query?
-
you stick it after the if post statement... http://www.php-mysql-tutorial.com/form-validation-with-php.php
-
<?php if (isset($_POST['yourpost']) && trim($_POST['yourpost']) == "") { $errMsgPost = "Error: You did not enter any text."; //no post entered ?>
-
ok i have sorted that part $query = "SELECT fe.*, u.email, u.ID FROM forum_email as fe INNER JOIN users as u ON u.ID = fe.user_id WHERE fe.topic_id = " . $forumpostid . " AND fe.mailed=1"; i was thinking why do i need to get fe.user_id != " . $id . " when im getting all the users under that topic its just this part now <?php while(?? = mysql_fetch_assoc($res) ) { //define the receiver of the email $to = ?? //define the subject of the email $subject = 'Test email'; //define the message to be sent. Each line should be separated with \n $message = "im sending an email too myself."; //define the headers we want passed. Note that they are separated with \r\n $headers = "From: n0144040@ntu.ac.uk\r\nReply-To: webmaster@example.com"; //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" echo $mail_sent ? "Mail sent" : "Mail failed"; }? if i was to send an email in the loop what would my while(?? = mysql_fetch_assoc($res) ) be ?? and how would i get the users emails from the query above?? the emails are stored in the user table under email
-
nice try bob but didnt work.. i got mail sent when i didnt use where so its in my where clause i take it
-
<?php $query = "SELECT fe.*, u.email, u.ID FROM forum_email as fe, users as u WHERE u.ID = fe.user_id AND fe.topic_id = " . $forumpostid . " AND fe.user_id != " . $id . " AND fe.mailed=1"; $res = @mysql_query($query) or die ("sendNotification query fails :".mysql_error()); echo $forumpostid; echo $id; //nobody wants an email, stop now if(mysql_num_rows($res)==0) { echo "no records returned"; exit; }?> i have a record in forum_email user_id topic_id mailed 1 484 1 but it keeps saying no reords returned... this is the 1st time i have used a joining query hense an error is prob in there!
-
sorry fixed that... but now for sending emails i get Warning: Invalid argument supplied for foreach() in /home/runningp/public_html/members/include/reply.php on line 75 <? $query = "SELECT fe.*, u.email, u.id FROM forum_email fe LEFT JOIN users as u on u.ID = fe.user_id WHERE topic_id = '".$forumpostid."' AND fe.user_id != '".$id."' AND mailed='n'"; $res = @mysql_query($query) or die ("sendNotification query fails :".mysql_error()); //nobody wants an email, stop now if(count($id) == 0): return; endif; foreach($id as $value) { //define the receiver of the email $to = $userinfo['email']; //define the subject of the email $subject = 'Test email'; //define the message to be sent. Each line should be separated with \n $message = "im sending an email too myself."; //define the headers we want passed. Note that they are separated with \r\n $headers = "From: n0144040@ntu.ac.uk\r\nReply-To: webmaster@example.com"; //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" echo $mail_sent ? "Mail sent" : "Mail failed"; }?>
-
did that now i get sendNotification query fails :Unknown column 'fe.id' in 'on clause' just getitng to learn these join statements
-
Could not connect: ... what was the error??
-
<?php // we connect to your website $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); ?> [code] give it a go and see what you get...
-
and use code tags!! <php echo ' the code tags will make it easyer to read?!?!?! ?>
-
this is new to me so here it goes... $query = "SELECT fe.*, u.email, u.id FROM forum_email as fe LEFT JOIN users as u on u.ID = fe.id WHERE topic_id = '".$forumpostid."' AND fe.user_id != '".$id."' AND mailed='n'"; $res = @mysql_query($query) or die ("sendNotification query fails :".mysql_error()); theres my query but i keep getting told im getting the data from the wrong tables... this is where im puliing it from table = users ID and from my other one table = forum_emails user_id topic_id mailed so form that where have i gone wrong :S
-
what other things can i run to produce the error
-
ok here is what i have tried <?php if (isset($_POST['submit1'])) { if ( ( time() - $userinfo['last_post'] ) >= 30 ) { $yourPost = mysql_real_escape_string($_POST['yourpost']); if (isset($_POST['yourpost']) && trim($_POST['yourpost']) == "") { $errMsgPost = "Error: You did not enter any text."; //no post entered } else { $insertpost = "INSERT INTO `forumtutorial_posts` (`author`,`forum`,`title`,`post`,`showtime`,`realtime`,`lastposter`,`parentid`) values('$username','$forum','$subject','$yourpost','$thedate','$thedate','$username','$forumpostid')"; mysql_query($insertpost) or die("Could not insert post"); //insert post $updatepost = "UPDATE `forumtutorial_posts` SET `numreplies`=`numreplies`+'1', `lastposter`='$username', `lastrepliedto`='$thedate' WHERE `postid`='$forumpostid'"; mysql_query($updatepost) or die("Could not update post"); $updatep = "UPDATE `users` SET `post_count`=`post_count`+'1', last_post=$thedate WHERE `Username`='$username'"; mysql_query($updatep) or die("Could not update post"); $query = "SELECT fe.*, u.email, u.name FROM forum_email as fe LEFT JOIN users as u on u.user_id = fe.user_id WHERE topic_id = '".$forumpostid."' AND fe.user_id != '".$id."' AND mailed='n'"; $res = @mysql_query($query,$link) or die ("sendNotification query fails :".mysql_error()); //nobody wants an email, stop now if(count($id) == 0): return; endif; foreach($id as $value) { //define the receiver of the email $to = $userinfo['email']; //define the subject of the email $subject = 'Test email for reply'; //define the message to be sent. Each line should be separated with \n $message = "im sending an email too myself."; //define the headers we want passed. Note that they are separated with \r\n $headers = "From: admin@runningprofiles.com"; //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" echo $mail_sent ? "Mail sent" : "Mail failed"; } //set emailed to 'y' so that they don't get numerous emails... set it back to 'n' when they view this topic $query_noted = "UPDATE forum_email SET mailed='y' WHERE topic_id = '".$forumtopicid."'"; // header("Location: index.php?page=message&forum=$forum&id=$forumpostid&pagenum=last"); } } } ?> but i sadly get "sendNotification query fails :" .... but no error from mysql_error()
-
ah ok sorry just been reading and found it at last... all you have to do is place it under the insert and it will echo it out! bingo
-
im trying to notify users that there post has been replied too.. the thing is grabbing to tipoid_id so i can insert it into the db... so when a post is beeing created i was going to do this <?php if (isset($_POST['email'])) { $insertpost = "INSERT INTO forumtutorial_posts(forum,author,title,post,showtime,realtime,lastrepliedto,lastposter) values('$forum','$username','$theSubject','$thePost','$thedate','$thedate','$thedate','$username')"; mysql_query($insertpost) or die("Could not insert post"); // RESOURCE ID IS IN $xyz $newPostID = mysql_insert_id($insertposts); echo $newPostID; //$insertemail = "INSERT INTO forum_email(user_id,topic_id,mailed) values('$id','$forumpostid','1')"; //mysql_query($insertemail) or die("Could not insert email"); //insert email $updatepost = "UPDATE `users` SET `post_count`=`post_count`+'1' WHERE `Username`='$username'"; mysql_query($updatepost) or die("Could not update post"); $newPostID = mysql_insert_id($insertpost); echo $newPostID; //header("Location: http://www.runningprofiles.com/members/index.php?page=forum&forum=$forum"); exit;?> Warning: mysql_insert_id(): supplied argument is not a valid MySQL-Link resource
-
oh boy thats why... i need to compare it to time... lol thanks DA
-
for some reason my if statement does not work <?php $lastpost = $userinfo['last_post']; echo $lastpost ; if ( $lastpost <= 30 ) {echo 'dont flood';} else { echo 'your not flooding';}?> it always echos your not flooding even if its been 5 seconds or 10 minutes.. echo $lastpost came out with 1226663481 so its grabing the time but i dont understand why its not echoing dont flood :S
-
looks fine 2 me
-
could be...its funny as the quote is the only thing not working and it was working fine abit ago