cs1h Posted November 13, 2007 Share Posted November 13, 2007 Hi, I have a script that is ment to send out a simple email but I get this error, Parse error: syntax error, unexpected T_VARIABLE in D:\Inetpub\vhosts\myroho.com\httpdocs\email_pass.php on line 12 The script is <?php include "mice.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); $abc = $_GET['id']; $sql = mysql_db_query($database, "select * from items WHERE id = '$abc'") or die (mysql_error()); $result = mysql_query($sql); $row = mysql_fetch_array($result) $Title = $row['Title']; $code1 = $row['code1']; $pass = $row['pass']; $email = $row['Email']; $mymail = "$email"; $cc = 'Edit your myroho posting'; $FrOm = "admin@myroho.com"; $BoDy = ''; $BoDy .= 'You made a posting called $Title on myroho'; $BoDy .= "\n"; $BoDy .= "\n"; $BoDy .= "You can now edit or delete them on the site, just follow the instructions below."; $BoDy .= "\n"; $BoDy .= "\n"; $BoDy .= 'To edit your posting, visit:'; $BoDy .= "\n"; $BoDy .= 'http://www.myroho.com/edit_step_one.php'; $BoDy .= "\n"; $BoDy .= "\n"; $BoDy .= 'To delete your posting, visit:'; $BoDy .= "\n"; $BoDy .= 'http://www.myroho.com/delete_step_one.php'; $BoDy .= "\n"; $BoDy .= "\n"; $BoDy .= 'To make the amendments you need the following posting reference:'; $BoDy .= $code1; $BoDy .= "\n"; $BoDy .= 'and the following password:'; $BoDy .= $pass; $BoDy .= "\n"; $BoDy .= 'Please save these details in a folder so you can edit or delete your posting.'; $BoDy .= "\n"; $BoDy .= "\n"; $BoDy .= 'When you make future postings you will be able to choose your own password.'; $BoDy .= "\n"; $BoDy .= "\n"; $BoDy .= 'Please note: We reserve the right to refuse or delete postings that we believe are inappropriate or which breach our terms and conditions.'; $BoDy .= "\n"; $BoDy .= "\n"; $BoDy .= 'Best Wishes'; $BoDy .= "\n"; $BoDy .= 'the myroho team'; $BoDy .= "\n"; $send = mail("$mymail", "$cc", "$BoDy", "From: $FrOm"); } } ?> I'm not very sure what I'm doing and therefore need some help, does anyone know how to correct this? Thanks Colin Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted November 13, 2007 Share Posted November 13, 2007 You're missing a semi colon at the end of this line: $row = mysql_fetch_array($result) Quote Link to comment Share on other sites More sharing options...
cs1h Posted November 13, 2007 Author Share Posted November 13, 2007 Thanks that solved that problem but I then get some more, Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\Inetpub\vhosts\myroho.com\httpdocs\email_pass.php on line 11 Warning: mail() [function.mail]: SMTP server response: 503 Bad sequence of commands. You must specify the recipients of a message before you can send it in D:\Inetpub\vhosts\myroho.com\httpdocs\email_pass.php on line 58 The script now looks like <?php include "mice.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); $abc = $_GET['id']; $sql = mysql_db_query($database, "select * from items WHERE id = '$abc'") or die (mysql_error()); $result = mysql_query($sql); $row = mysql_fetch_array($result); $Title = $row['Title']; $code1 = $row['code1']; $pass = $row['pass']; $email = $row['Email']; $mymail = $email; $cc = 'Edit your myroho posting'; $FrOm = "admin@myroho.com"; $BoDy = ''; $BoDy .= 'You made a posting called $Title on myroho'; $BoDy .= "\n"; $BoDy .= "\n"; $BoDy .= "You can now edit or delete them on the site, just follow the instructions below."; $BoDy .= "\n"; $BoDy .= "\n"; $BoDy .= 'To edit your posting, visit:'; $BoDy .= "\n"; $BoDy .= 'http://www.myroho.com/edit_step_one.php'; $BoDy .= "\n"; $BoDy .= "\n"; $BoDy .= 'To delete your posting, visit:'; $BoDy .= "\n"; $BoDy .= 'http://www.myroho.com/delete_step_one.php'; $BoDy .= "\n"; $BoDy .= "\n"; $BoDy .= 'To make the amendments you need the following posting reference:'; $BoDy .= $code1; $BoDy .= "\n"; $BoDy .= 'and the following password:'; $BoDy .= $pass; $BoDy .= "\n"; $BoDy .= 'Please save these details in a folder so you can edit or delete your posting.'; $BoDy .= "\n"; $BoDy .= "\n"; $BoDy .= 'When you make future postings you will be able to choose your own password.'; $BoDy .= "\n"; $BoDy .= "\n"; $BoDy .= 'Please note: We reserve the right to refuse or delete postings that we believe are inappropriate or which breach our terms and conditions.'; $BoDy .= "\n"; $BoDy .= "\n"; $BoDy .= 'Best Wishes'; $BoDy .= "\n"; $BoDy .= 'the myroho team'; $BoDy .= "\n"; $send = mail("$mymail", "$cc", "$BoDy", "From: $FrOm"); ?> Any ideas how to solve this, Thanks Colin Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 13, 2007 Share Posted November 13, 2007 You forgot the semi-colon at the end of this line: <?php $row = mysql_fetch_array($result) ?> You have other problems with your code and it can be shortened: <?php include "mice.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); $abc = $_GET['id']; $sql "select * from items WHERE id = '$abc'"; $result = mysql_query($sql) or die("Problem with the query: $sql<br>" . mysql_error()); $row = mysql_fetch_assoc($result) $Title = $row['Title']; $code1 = $row['code1']; $pass = $row['pass']; $email = $row['Email']; $mymail = $email; $SubJect = 'Edit your myroho posting'; $FrOm = "admin@myroho.com"; $BoDy = "You made a posting called $Title on myroho\n\n"; $BoDy .= "You can now edit or delete them on the site, just follow the instructions below.\n\n"; $BoDy .= "To edit your posting, visit:\n"; $BoDy .= "http://www.myroho.com/edit_step_one.php\n\n"; $BoDy .= "To delete your posting, visit:\n"; $BoDy .= "http://www.myroho.com/delete_step_one.php\n\n"; $BoDy .= "To make the amendments you need the following posting reference:$code1\n"; $BoDy .= "and the following password:$pass\n"; $BoDy .= "Please save these details in a folder so you can edit or delete your posting.\n\n"; $BoDy .= "When you make future postings you will be able to choose your own password.\n\n"; $BoDy .= "Please note: We reserve the right to refuse or delete postings that we believe are inappropriate or which breach our terms and conditions.\n\n"; $BoDy .= "Best Wishes\n"; $BoDy .= "the myroho team\n"; $send = mail($mymail, $SubJect, $BoDy, "From: $FrOm"); } } ?> Ken Quote Link to comment Share on other sites More sharing options...
atlanta Posted November 13, 2007 Share Posted November 13, 2007 Try this <?php include "mice.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); mysql_select_db("mysql_dbname") $abc = $_GET['id']; $sql = "select * from items WHERE id = '$abc'"; $result = mysql_query($sql) or die("Problem with the query: $sql<br>" . mysql_error()); $row = mysql_fetch_array($result) $Title = $row['Title']; $code1 = $row['code1']; $pass = $row['pass']; $email = $row['Email']; $mymail = $email; $SubJect = 'Edit your myroho posting'; $FrOm = "admin@myroho.com"; $BoDy = "You made a posting called $Title on myroho\n\n"; $BoDy .= "You can now edit or delete them on the site, just follow the instructions below.\n\n"; $BoDy .= "To edit your posting, visit:\n"; $BoDy .= "http://www.myroho.com/edit_step_one.php\n\n"; $BoDy .= "To delete your posting, visit:\n"; $BoDy .= "http://www.myroho.com/delete_step_one.php\n\n"; $BoDy .= "To make the amendments you need the following posting reference:$code1\n"; $BoDy .= "and the following password:$pass\n"; $BoDy .= "Please save these details in a folder so you can edit or delete your posting.\n\n"; $BoDy .= "When you make future postings you will be able to choose your own password.\n\n"; $BoDy .= "Please note: We reserve the right to refuse or delete postings that we believe are inappropriate or which breach our terms and conditions.\n\n"; $BoDy .= "Best Wishes\n"; $BoDy .= "the myroho team\n"; $send = mail($mymail, $SubJect, $BoDy, "From: $FrOm"); } } ?> Quote Link to comment Share on other sites More sharing options...
cs1h Posted November 13, 2007 Author Share Posted November 13, 2007 Hi, I changed the script to the one above that you surgested but it gives the error, Parse error: syntax error, unexpected T_VARIABLE in D:\Inetpub\vhosts\myroho.com\httpdocs\email_pass.php on line 5 The script now looks like this, <?php include "mice.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); mysql_select_db("mysql_dbname") $abc = $_GET['id']; $sql = "select * from items WHERE id = '$abc'"; $result = mysql_query($sql) or die("Problem with the query: $sql<br>" . mysql_error()); $row = mysql_fetch_array($result) $Title = $row['Title']; $code1 = $row['code1']; $pass = $row['pass']; $email = $row['Email']; $mymail = $email; $SubJect = 'Edit your myroho posting'; $FrOm = "admin@myroho.com"; $BoDy = "You made a posting called $Title on myroho\n\n"; $BoDy .= "You can now edit or delete them on the site, just follow the instructions below.\n\n"; $BoDy .= "To edit your posting, visit:\n"; $BoDy .= "http://www.myroho.com/edit_step_one.php\n\n"; $BoDy .= "To delete your posting, visit:\n"; $BoDy .= "http://www.myroho.com/delete_step_one.php\n\n"; $BoDy .= "To make the amendments you need the following posting reference:$code1\n"; $BoDy .= "and the following password:$pass\n"; $BoDy .= "Please save these details in a folder so you can edit or delete your posting.\n\n"; $BoDy .= "When you make future postings you will be able to choose your own password.\n\n"; $BoDy .= "Please note: We reserve the right to refuse or delete postings that we believe are inappropriate or which breach our terms and conditions.\n\n"; $BoDy .= "Best Wishes\n"; $BoDy .= "the myroho team\n"; $send = mail($mymail, $SubJect, $BoDy, "From: $FrOm"); } } ?> Any ideas why? Thanks for all the help so far, Colin Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 13, 2007 Share Posted November 13, 2007 No semi-colon on <?php $row = mysql_fetch_array($result) ?> That error usually means either a semi-colon was not found or a quoted string was not finished. Ken Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted November 13, 2007 Share Posted November 13, 2007 We're still missing two semi-colons. When you get that sort of error, always take a look at the line before too - it's a VERY common mistake. <?php include "mice.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); mysql_select_db("mysql_dbname"); $abc = $_GET['id']; $sql = "select * from items WHERE id = '$abc'"; $result = mysql_query($sql) or die("Problem with the query: $sql<br>" . mysql_error()); $row = mysql_fetch_array($result); $Title = $row['Title']; $code1 = $row['code1']; $pass = $row['pass']; $email = $row['Email']; $mymail = $email; $SubJect = 'Edit your myroho posting'; $FrOm = "admin@myroho.com"; $BoDy = "You made a posting called $Title on myroho\n\n"; $BoDy .= "You can now edit or delete them on the site, just follow the instructions below.\n\n"; $BoDy .= "To edit your posting, visit:\n"; $BoDy .= "http://www.myroho.com/edit_step_one.php\n\n"; $BoDy .= "To delete your posting, visit:\n"; $BoDy .= "http://www.myroho.com/delete_step_one.php\n\n"; $BoDy .= "To make the amendments you need the following posting reference:$code1\n"; $BoDy .= "and the following password:$pass\n"; $BoDy .= "Please save these details in a folder so you can edit or delete your posting.\n\n"; $BoDy .= "When you make future postings you will be able to choose your own password.\n\n"; $BoDy .= "Please note: We reserve the right to refuse or delete postings that we believe are inappropriate or which breach our terms and conditions.\n\n"; $BoDy .= "Best Wishes\n"; $BoDy .= "the myroho team\n"; $send = mail($mymail, $SubJect, $BoDy, "From: $FrOm"); } } ?> Edit: Beaten to it, but there's the other line without a semi colon - mysql_select_db("mysql_dbname") - so posted anyway Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.