Jump to content

[SOLVED] help with T_VARIABLE


cs1h

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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");
}
}
?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.