[PHP-DB] Do while loop inside of mail()
MySQL 4.1/PHP 4.2 I am trying to generate a email to send to people with a list of events happening through out the month. I am pulling the email addresses from the database with no problem, but when I put the list of events inside of the mail(), it barks at the do while statment. Here is the do while code: $message='table width=100% border=0 tr class=style2 td width=20% class=style8uProject Number /u/td td width=20%ustrongStart Date/strong/u/td td width=26%ustrongClass/strong/u/td td width=34%ustrongLocation/strong/u/td /tr/table Line 28 'do { .' tr class=style2 td width=20% class=style8'.$row_Recordset1['pnumber'].'/td td width=20%'.date(m/d/Y, strtotime($row_Recordset1['Sdate'])).'/td td width=26%'.$row_Recordset1['title'].'/td td width=34%'.$row_Recordset1['location'].'/td /tr'. while } $row_Recordset1 = mysql_fetch_assoc($Recordset1)).'/table'; And the server response *Parse error*: parse error in */home/Data/email/test.php* on line *28* Line 28 is the start of the do while loop markb -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Date Conversion
PHP 4.4/MySQL 4.0 I am tying to convert a date to put into a database from a string (ie: January, February) to a numeric value (ie: 01,02). I am taking the value from a form, which is a drop down menu listing the months. $sMonth1 = $_POST['Smonth']; returns the money selected from the form. When I go to format the month from a string to numeric with date('m',strtotime($sMonth1)); it returns 12, no matter which month I select. In reading the docs at php.net, date('m',strtotime($sMonth1)); is correct to reformat from a string to a time format. What am I missing. mark bomgardner -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Result set in different columns
I am trying to work through some display logic where I want to display a results set from a database query into to columns in a table, but I can't see to get it correct. Example; I want to loop through the months of the year and display them like this; JanuaryFebruary March April MayJune JulyAugust September October November December Any ideas? Mark Bomgardner -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Mail Function
I have been racking my brain for the better part of a day with a simple mail function. I am trying to generate a list of events from MySQL and then use the php Mail function to email the list in an html email to a mailing list. I keep getting a parse error on a section that I can not figure out why. The code is attached Markb ?php require_once('../../Connections/flatfoot.php'); mysql_select_db($database_flatfoot, $flatfoot); $query_Recordset1 = SELECT * FROM tblTrnEvent WHERE tblTrnEvent.Sdate BETWEEN '2006-03-02' AND '2006-04-30' AND Etype = 'K' ORDER BY Sdate; $Recordset1 = mysql_query($query_Recordset1, $flatfoot) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); mail('[EMAIL PROTECTED]','Test Mail Message', '!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html head meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 titleUp Coming Training/title style type=text/css !-- .title { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 18px; color: #FF; text-decoration: blink; letter-spacing: .50em; word-spacing: normal; } .head { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; color: #FF; } .text { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: normal; } .specialtext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color: #FF; } -- /style /head body table width=75% border=0 tr td class=titlediv align=centerUpcoming Training Event /div/td /tr tr td class=headdiv align=centerSponsored by The Kansas Law Enforcement Training Center /div/td /tr tr tdnbsp;/td /tr tr td class=textpListed below, yoursquo;ll find an assortment of Specialized Training classes being offered by the Kansas Law Enforcement Training Center during the months of March and April. Of special interest are the Ethics Instructor class being offered March 13 ndash; 17; Field Training Officer class being offered March 13 ndash; 15 in Dodge City; Crime Scene and Arson Photography class offered March 16 ndash; 17. These classes should have a significant impact on those officers attending, providing new insight and expertise to your agency./p/td /tr tr td class=textnbsp;/td /tr tr td class=texttable width=100% border=0 tr td width=15%uStart Date /u/td td width=15%uProject Number /u/td td width=35%uClass Title /u/td td width=34%uLocation/u/td /tr'. do { if($row_Recordset1['special'] =='Y'){ .'tr class=specialtext td height=22'.date(m/d/Y, strtotime($row_Recordset1['Sdate'])).'/td td'.$row_Recordset1['pnumber'].'/td td'.$row_Recordset1['title'].'/td td width=34%.'$row_Recordset1['city'].'/td /tr'. }else{ .'tr td'.date(m/d/Y, strtotime($row_Recordset1['Sdate'])).'/td td'.$row_Recordset1['pnumber'].'/td td'.$row_Recordset1['title'].'/td td'.$row_Recordset1['city'].'/td /tr'. } } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)).' /table/td /tr /table /body /html '.mysql_free_result($Recordset1).'') ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Future Event
Is there a way in php to execute a SELECT statement in the future? What I am wanting to do is use a page to parse a database at a future time. I want to send out some email about an event I am putting on, but I don't want to execute the select statement until 2:00am. I could use cron for this, but I would perfer not, as I am writing an application in which cron may not be an option. Is there 3rd party engines that will do this? Mark -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to compare crypted password with stored in MySQL
Eduardo Bejar wrote: Hi, I have a MySQL database with encrypted passwords, that were created with: $input_password = $_POST[password]; $salt = ab; /// Salt is always two character string and the same for all $password_to_save = crypt($input_password, $salt); and then saved in MySQL with: insert into password_table set passwd='$password_to_save'; (other columns are inserted also, but passwd is the one related to this question). Now, to check if a password is valid, I set $salt as the first two characters of the stored encrypted password, and with this salt I crypt and compare both: $salt = substr ($password_stored_in_mysql, 0,2); $password_to_check = crypt($input_password, $salt); if ($password_to_check == $password_stored_in_mysql) echo Password is the same; This used to work on a PC that runs PHP 4.1.2 and MySQL 3.23.36. But when trying this on other PC that runs PHP 4.3.11 and MySQL 3.23.58, I get no password match, as $password_to_check is different from the one stored in the database. In example: $password_to_check shows ab2vG8KakAAGY and the stored one is abFcR2QZ/2fUU. What could be causing this? How should I compare the passwords? Thank you, Edo Instead of using PHP, use MySQL MD5 to encrypt the string. You could do the encryption on the insert and then when you want to check the password, use the MD5 on the select statement. I have done it both ways, and I perfer to use MySQL to do it. My $.02 worth -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php