![]() |
|
#1
|
|||
|
|||
Mail message with variablesDear All
I am trying configure a function that will send a mail to my users informing them of their password. I would like it to include some information in the message like, name, title etc. My problem begins!! The Error I am getting with my code is; Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/sites/site112/web/fp.php on line 20 The code is; <?php //connection functions etc. require_once ('incl_funs.php'); do_header('Password Sent','Password<br/>Sent'); $username=$HTTP_POST_VARS['username']; $email=$HTTP_POST_VARS['email']; $subject=$HTTP_POST_VARS['subject']; $fromaddress='p.robertson@boltd.co.uk'; do_db_connect(); $query = 'SELECT * from users, userdata WHERE (users.username= '.$username.') AND (users.username= userdata.username)'; $result = mysql_query($query); $num_results=mysql_num_rows($result); $row; $row = mysql_fetch_array($result); if ($email==$row['email']) { //This line is showing the error $mailcontent="Dear $row['salutation'] $row['fname']\r\n\r\n Your password is $row['passwd']. May I recommend that change your password to something memorable by visiting www.boltd.co.uk Best Regards \r\n \r\n Philip Robertson\r\n BOLTd"; mail ($email,$subject,$mailcontent,$fromaddress); } Any suggestions from you gurus out there? Cheers Phil p.s. I am not sure if this is the correct way to include code please let me know if there is a more approved of method for future ref. |
|
#2
|
||||
|
||||
|
Just a quick observation here; perhaps it's related to your problem, perhaps not -
Inside double quotes: PHP Code:
Also quote the string(?) in the sql query? PHP Code:
re:quoting PHP code Please view the FAQ to highlight PHP code (see the sample at the bottom of the page) in your posts. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
|||
|
|||
|
Cheers JDS
That was the exact problem I was having and your suggestion fixed it immediately. I get a bit confused about ' and ". I thought I had tried every combination of quotes and no quotes. Clearly I was mistaken!! I shall use the vB tags next time. Once again Thank you Phil |
Recent GIDBlog
NARMY by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Free message board hosting, 30 skins, 11 languages. | edkhosting | Free Web Hosting | 1 | 27-Feb-2004 13:14 |
| Reliable Hosting $2-$8/month: PHP, MySQL, FrontPage, CGI, SSH, FTP, POP3, Web Mail | fcolor | Web Hosting Advertisements & Offers | 0 | 04-Nov-2003 06:03 |
| 600MB Space, 20GB Banwidth, PHP, MySQL, CGI, SSH, FrontPage, FTP, POP3, Web Mail | fcolor | Web Hosting Advertisements & Offers | 0 | 08-Aug-2003 10:11 |
| E Mail Forwarding | nikkotash | Computer Software Forum - Windows | 3 | 30-Jun-2003 03:20 |
| PHP variables | nniehoff | MySQL / PHP Forum | 7 | 26-Jul-2002 06:25 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The