Jump to content

joshuaer

Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by joshuaer

  1. joshuaer

    PHP MySql Help

    I have been trying to figure out what I am doing wrong but am not sure, with the code below it show me the information that should go out in the emails, and it is correct. There are 2 emails that should be going out but it is showing the sendmail results as 0 I am guessing that it is my if statement that I have incorrect can someone please point me in the right direction. Thanks <?phpini_set('display_errors', 1);error_reporting(E_ALL);mysql_connect("", "", "") or die(mysql_error());mysql_select_db("") or die(mysql_error());$headers = 'iChores.com';$d = date ("D");$result = mysql_query("SELECT * FROM users where day='$d'")or die(mysql_error());while ($row = mysql_fetch_assoc($result)) {//$row = mysql_fetch_assoc($result);echo $row["Cnumber"];echo $row["address"];echo $row["iChore1"];echo $row["iChore2"];echo $row["iChore3"];echo $row["iChore4"];echo $row["iChore5"];} $txt = "Todays iChores - "; if(mysql_num_rows($result) > 0)//if ($row){$count = 0;while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)){$message = $txt . $row['iChore1'].' ' . $row['iChore2'].' ' . $row['iChore3'].' ' . $row['iChore4'].' ' . $row['iChore5'];$to = $row['Cnumber'] . $row['address'];mail($to, $headers, $message);$count++;}echo "myResult=$count Emails Sent. Done.";print $row;echo "$row";//print $message;//print $day;}else{echo "myResult=Email Submissions Failed.";}?>
  2. joshuaer

    PHP MySql Help

    it runs with out any errors but the echo I have set in it to show the results says there are 0 emails sent, but there are 2 that should go out for Fri
  3. joshuaer

    PHP MySql Help

    <?phpini_set('display_errors', 1);error_reporting(E_ALL);mysql_connect("", "", "") or die(mysql_error());mysql_select_db("") or die(mysql_error());$headers = 'iChores.com';$d = date ("D");$result = mysql_query("SELECT * FROM users where day='$d'")or die(mysql_error());while ($row = mysql_fetch_assoc($result)) {}//$row = mysql_fetch_assoc($result);//$Cnumber = mysql_result($result,0,"Cnumber");//$address = mysql_result($result,1,"address");//$iChore1 = mysql_result($result,0,"iChore1");//$iChore2 = mysql_result($result,0,"iChore2");//$iChore3 = mysql_result($result,0,"iChore3");//$iChore4 = mysql_result($result,0,"iChore4");//$iChore5 = mysql_result($result,0,"iChore5"); $txt = "Todays iChores - ";if(mysql_num_rows($result) > 0)//if ($row){$count = 0;while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)){$message = $txt . $row['iChore1'].' ' . $row['iChore2'].' ' . $row['iChore3'].' ' . $row['iChore4'].' ' . $row['iChore5'];$to = $row['Cnumber'] . $row['address'];mail($to, $headers, $message);$count++;}echo "myResult=$count Emails Sent. Done.";print $row;echo "$row";//print $message;//print $day;}else{echo "myResult=Email Submissions Failed.";}?>
  4. joshuaer

    PHP MySql Help

    <p>does this look correct So Called? It is running without error but it is saying there are no emails to send and there is a record in the day field for Fri</p><p> </p><p> </p><div><?php</div><div>ini_set('display_errors', 1);</div><div>error_reporting(E_ALL);</div><div> </div><div> </div><div>mysql_connect("", "", "") or die(mysql_error()); </div><div>mysql_select_db("") or die(mysql_error()); </div><div>$headers = '';</div><div>$d = date ("D");</div><div>$result = mysql_query("SELECT * FROM users where day='$d'")or die(mysql_error());</div><div>while ($row = mysql_fetch_assoc($result)) {</div><div>}</div><div>//$row = mysql_fetch_assoc($result);</div><div>//$Cnumber = mysql_result($result,0,"Cnumber");</div><div>//$address = mysql_result($result,1,"address");</div><div>//$iChore1 = mysql_result($result,0,"iChore1");</div><div>//$iChore2 = mysql_result($result,0,"iChore2");</div><div>//$iChore3 = mysql_result($result,0,"iChore3");</div><div>//$iChore4 = mysql_result($result,0,"iChore4");</div><div>//$iChore5 = mysql_result($result,0,"iChore5");</div><div> </div><div>$txt = "Todays iChores - ";</div><div> </div><div> </div><div> </div><div>if(mysql_num_rows($result) > 0) </div><div> </div><div>//if ($row)</div><div> </div><div>{ </div><div>$count = 0; </div><div>while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) </div><div>{</div><div>$message = $txt . $row['iChore1'].' ' . $row['iChore2'].' ' . $row['iChore3'].' ' . $row['iChore4'].' ' . $row['iChore5'];</div><div>$to = $row['Cnumber'] . $row['address']; </div><div> </div><div> </div><div> </div><div> </div><div>mail($to, $headers, $message); </div><div>$count++; </div><div>} </div><div>echo "myResult=$count Emails Sent. Done."; </div><div>print $row;</div><div>echo "$row";</div><div>//print $message;</div><div>//print $day;</div><div> </div><div>} </div><div>else </div><div>{ </div><div>echo "myResult=Email Submissions Failed."; </div><div> </div><div>}</div><div> </div><div>?></div>
  5. joshuaer

    PHP MySql Help

    I do need to put it in a loop so it will check each line, not exactly sure what is the best way to do that. would I use for to loop through? Thanks again
  6. joshuaer

    PHP MySql Help

    Ok, thank you so much for the help I removed the other select line and just have this $d = date ("D");$result = mysql_query("SELECT * FROM users where day='$d'")or die(mysql_error());$row = mysql_fetch_assoc($result); and it looks to be working the way I want now Thanks again
  7. joshuaer

    PHP MySql Help

    Yes but when the script runs it sends out the email to everyone in the database even if the day does not match
  8. joshuaer

    PHP MySql Help

    they are stored by Mon,Tue,Wed,etc
  9. joshuaer

    PHP MySql Help

    I am fairly new to this so sorry if this sounds stupid but I need it to look at every record to look at reach row until it finds a match then sends out the email to the address in that row along with the data in the row for the content of the email.
  10. joshuaer

    PHP MySql Help

    Hello I am trying to create a sendmail script that looks at my database in the day field and compares it to the current date. When I run the script it works fine but it sends out the email even if it does not match the current date. can someone please look at my script and tell me what I am doing wrong. Thank you in advance <?phpini_set('display_errors', 1);error_reporting(E_ALL); mysql_connect("", "", "") or die(mysql_error()); mysql_select_db("") or die(mysql_error()); $headers = '';$result = mysql_query("SELECT * FROM users")or die(mysql_error());$row = mysql_fetch_assoc($result);$Cnumber = mysql_result($result,$row,"Cnumber");$address = mysql_result($result,$row,"address");$iChore1 = mysql_result($result,$row,"iChore1,");$iChore2 = mysql_result($result,$row,"iChore2");$iChore3 = mysql_result($result,$row,"iChore3,");$iChore4 = mysql_result($result,$row,"iChore4");$iChore5 = mysql_result($result,$row,"iChore5"); $txt = "Todays iChores - "; $d = date ("D");$day = ("SELECT * FROM users where day='$d'"); if ($day) { $count = 0; while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {$message = $txt . $row['iChore1'].', ' . $row['iChore2'].', ' . $row['iChore3'].', ' . $row['iChore4'].', ' . $row['iChore5'];$to = $row['Cnumber'] . $row['address']; mail($to, $headers, $message); $count++; } echo "myResult=$count Emails Sent. Done."; print $to;print $message;print $day; } else { echo "myResult=Email Submissions Failed."; } ?>
  11. Sorry, not to sound like an complete idiot but in the script I put in above, I would run that with a cronjob everyday to have it check the current day against the day in the database. But I really dont understand is when it finds matching data from the curent day and the day set in the database is how it will know to run the sendmail portion of the script. is there a if statment I need to add in there after date function thats say if the days match up run sendmail for the matching columns?
  12. Thanks for the reply, once it determines the correct day how do I correlate that to tell it to send the email? Not sure how to tell the script that once the days match for current day and what is in the database to send the email Thanks again
  13. I am fairly new to php and mysql but I have created a small site that users log into and create tasks to be sent to specified email on certain daysThe days are stored in the database as mon tue wed, etc. and I have a column for each day in the database (dont know if that is a good way to do it)The script is will send the information to all the emails in the database when the script is manually.Using cron jobs I will schedule the script to run two times a day to send out each users data to their emails.but I dont know how to tell the script to compare the days the users have specified in the database with the current day to see if it needs to send the email to the users email that daylooking around different sites I found this query that may do what I am wanting but I am not sure how to tell hte script to send out the emails after getting the data from the query select from mailinglist where daytosend = dayofweek(now())Here is my sendmail script, if I run it manually it works correctly and sends out the users data but currently configured does not take into account the days<?phpini_set('display_errors', 1);error_reporting(E_ALL); mysql_connect("", "", "") or die(mysql_error()); mysql_select_db("") or die(mysql_error()); $headers = '';$result = mysql_query("SELECT * FROM users")or die(mysql_error());$row = mysql_fetch_assoc($result);$Cnumber = mysql_result($result,$row,"Cnumber");$address = mysql_result($result,$row,"address");$info1= mysql_result($result,$row,"info1,");$info2= mysql_result($result,$row,"info2");$info3= mysql_result($result,$row,"info3,");$info4= mysql_result($result,$row,"info4");$info5= mysql_result($result,$row,"info5");$txt = "Today's info- "; if(mysql_num_rows($result) > 0) { $count = 0; while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {$message = $txt . $row['info1'].', ' . $row['info2'].', ' . $row['info3'].', ' . $row['info4'].', ' . $row['info5'];$to = $row['Cnumber'] . $row['address']; mail($to, $headers, $message); $count++; } echo "myResult=$count Emails Sent. Done."; print $to;print $message;} else { echo "myResult=Email Submissions Failed."; } ?>
  14. with this code I also need to have it look at the dates stored in the database and send the data on the days that are in the rows for the users. This is what I have but I am not sure how to make it send out on the days. I have the days in the database as mon,tue,wed,etc Thanks
  15. Thanks for the reply birbal, if you cant already tell I am fairly new to php and mysql. do you have an example of this I can look at or maybe a link to a website that has an example. I have beel looking around for several days and cannot quite seem to find what I am looking for Thanks again
  16. Would I create a if statement so if the current day matches the day in the database it would trigger the sendmail action?
  17. Hello I have a forum that members fill out to have reminders sent to them on certain days that I am working on. I am trying to figure out how to make these reminders only send out on the days the members specify in the forum is there a way that the cron job can run check the days stored in mysql database against the current day and then if it is suppose to send that day send out the reminder? Thanks
  18. Thank you very much, I did not ralize I missed that. That did the trick
  19. Thank you so much that worked, the error report returned this Notice: Undefined variable: row in /on line 12Notice: Undefined variable: row in /on line 13 those two lines are $Cnumber = mysql_result($result,$row,"Cnumber");$address = mysql_result($result,$row,"address"); but everything worked how it should have, it pulled the two columns, combined them and sent the email to the combined information
  20. Ya it is putting Cnameaddress over and over and not actually pulling in the data from those columns
  21. can you tell me what I am doing wrong with this? I can manually put the email address in the $to = and it will send just fine but if I put the $Cnumber."".$address in there it is not working. <?phpmysql_connect("", "", "") or die(mysql_error());mysql_select_db("") or die(mysql_error());$headers = from;$result = mysql_query("SELECT * FROM users")or die(mysql_error());$Cnumber = mysql_result($result,$row,"Cnumber");$address = mysql_result($result,$row,"address");if(mysql_num_rows($result) > 0){$message = 'hello';$count = 0;while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)){$to .= $Cnumber."".$address;mail($to, $headers, $message);$count++;}echo "myResult=$count Emails Sent. Done.";echo $to;}else{echo "myResult=Email Submissions Failed.";}?>
  22. $row=1;This is code I was working from that I found from a sendmail tutorial page $numrows=mysql_num_rows($result);$bccfield="Bcc: ". mysql_result($result,0,"email");while($row<$numrows){$email=mysql_result($result,$row,"email");$bccfield .= "," . $email;$row++;}$bccfield .= "\r\n";
  23. Hello I am fairly new to PHP and MySql and have started working on a small test site that has a basic login that creates a user, forwards them to a member page and on that member page has a field for inputting their cell phone number and another drop down that allows them to chose what cell carrier they have. This works well and caputures the data correctly, but what I am trying to do is creat a sendmail script that pulls the data from the two different colums and places them both into the bcc of the sendmail to send a mms text to the user. I can manually put in the information and the sendmail will send it out correctly but I cannot seem to figure out how to pull it from mysql Two columns CellNumber - - - CellAddress 1112223333 @txt.att.net thank you for any help or suggestions
×
×
  • Create New...