Page 1 of 1

Parse error: syntax error, unexpected T_VARIABLE

Posted: Wed Jun 17, 2009 11:30 pm
by breWtal
This is racking my brain. I am getting the all infamous "Parse error: syntax error, unexpected T_VARIABLE" message. I know that the majority of the time it means your either missing a semi-colon or opening/closing brackets in statements. I have checked my code at least 20 times and I am just not seeing it!

im hoping someone here can help me, and point this out to my tired mind

exact error msg im getting is:
Parse error: syntax error, unexpected T_VARIABLE in /homepages/46/d285340853/htdocs/sms/SMS.Script.v2.1/config.php on line 19

here is the code:
<?

function db_connect()
{
$result = mysql_connect("localhost", "user", "pass"); // xxx, xxx, xxx
if(!$result)
return false;
if(!mysql_select_db("sms")) // xxx
return false;

return $result;
}

db_connect();

$alloweduses = 50 // The number of messages that users can send in one day (based on IP address)

// Headers for the message - they need some, and some prohibit them.
$headerstouse = "MIME-Version: 1.0\r\n". //On Request
"Content-type: text/html; charset=utf8\r\n"; //On Request
"From: \".$from."\r\n"; //Required
"To: \"Client\" <".$to.">\r\n";//Required
"Date: ".date("r")."\r\n";//Optional
"Subject: ".$subject."\r\n";//Optional
?>

so far ive had to convert the code from russian to english, so maybe something was lost in the translation.

Re: Parse error: syntax error, unexpected T_VARIABLE

Posted: Thu Jun 18, 2009 12:18 am
by iWizard
That should work. I have not gotten a chance to test it but it should fix the error.

Code: Select all

<?
 
function db_connect()
{
$result = mysql_connect("localhost", "user", "pass"); // xxx, xxx, xxx
if(!$result)
return false;
if(!mysql_select_db("sms")) // xxx
return false;
 
return $result;
}
 
db_connect();
 
$alloweduses = 50; // The number of messages that users can send in one day (based on IP address)
 
// Headers for the message - they need some, and some prohibit them.
$headerstouse = "MIME-Version: 1.0\r\n".
"Content-type: text/html; charset=utf8\r\n".
"From: ".$from."\r\n".
"To: \"Client\" <".$to.">\r\n".
"Date: ".date("r")."\r\n".
"Subject: ".$subject."\r\n";
?>

Re: Parse error: syntax error, unexpected T_VARIABLE

Posted: Thu Jun 18, 2009 12:51 am
by breWtal
Thankyou very much iWizard, that got me over that hurdle, now when i run the script, the correct page opens