Parse Error Unexpected T_variable Expecting T_old_function
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more
Syntax Error Unexpected '$this' (t_variable) Expecting Function (t_function)
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users expecting function (t_function) php Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping
Syntax Error, Unexpected '$data' (t_variable), Expecting Function (t_function)
each other. Join them; it only takes a minute: Sign up unexpected T_VARIABLE, expecting T_FUNCTION up vote 11 down vote favorite 3 I am expecting this to be a basic syntax error I overlooked, but I can't figure expecting t_function it out. In a PHP script, I keep getting the following error. Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in [path]/scripts/users/database_connection.php on line 4 This occurs when my script to connect to the database is called with an include_once(). I stripped my script down to the most basic code (leaving in what is required by other code), and it still is calling this error. I have struggled with this for a while, and just wondered if anyone else could spot somewhere I went wrong. php sqlite syntax-error share|improve this question asked Jun 26 '11 at 20:50 Ryan Leonard 5241525 add a comment| 4 Answers 4 active oldest votes up vote 14 down vote accepted You can not put $connection = sqlite_open("[path]/data/users.sqlite", 0666); outside the class construction. You have to put that line inside a function or the constructor but you can not place it where you have now. share|improve this answer answered Jun 26 '11 at 20:53 Sabeen Malik 9,19821940 Thank you, first time I tried to use OOP. –Ryan Leonard Jun 26 '11 at 20:57 @Rhino , its aright. @Lekensteyn has done a wonderful job and shows you how you should ideally do it. –Sabeen Malik Jun 26 '11 at 20:58 add a comment| up vote 13 down vote You cannot use function calls in a class construction, you should initialize that value in the constructor function. From the PHP Manual on class properties: This declaration may include an initialization, but this initialization must be a constant value--that is, it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated. A working code s
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more
Syntax Error, Unexpected '->' (t_object_operator)
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users class constructor php Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping
Parse Error Syntax Error Unexpected T_variable
each other. Join them; it only takes a minute: Sign up php mailer parse error up vote 0 down vote favorite I have a site that is hosted on inmotion hosting and requires a phpMailer in order to send http://stackoverflow.com/questions/6486660/unexpected-t-variable-expecting-t-function an email form (such as a contact form) from a site. I've put the necessary files and code on the contact page, but I am getting a parse error once I hit submit. Here's the error message: Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/username/public_html/phpmailer/class.phpmailer.php on line 53 Line 53 according to DreamWeaver is public $Priority = 3; Does anyone know why I might be getting a parse error? http://stackoverflow.com/questions/4752889/php-mailer-parse-error forms phpmailer comments share|improve this question asked Jan 20 '11 at 21:36 Katie 2416 Katie, please give some more lines of code. Is public $Priority inside a class or not? –MDI Jan 20 '11 at 21:51 the issue is more than likely on line 52, as the parser looks for the } before the public keyword, this is why it says line 53. show several lines either side and we should be able to help you. –RobertPitt Jan 20 '11 at 21:53 I downloaded the file directly from this link. It's phpmailer v.5 –Katie Jan 20 '11 at 22:15 sourceforge.net/projects/phpmailer/files/… –Katie Jan 20 '11 at 22:16 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote accepted Server PHP version problem. This error occurs when a web server is running an older version of PHP (probably php4) and the phpmailer version you've download is for PHP5. Only your web hosting company can upgrade PHP to the new version. option 1: Download phpmailer for PHP4: link here. Then Rename (or delete) the phpmailer you've got now and replace it with the php4 version. option 2: Change web hosting providers to one offering more modern accommodations. good luck! ps. Once you've decided to accept an answer, click the "check" to the left of this box to let the commu
T_OLD_FUNCTION If this is your first visit, be sure to http://board.phpbuilder.com/showthread.php?10331077-Parse-error-syntax-error-unexpected-T_VARIABLE-expecting-T_OLD_FUNCTION check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 5 syntax error of 5 Thread: Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 10-19-2006,07:25 PM #1 Twysted View Profile syntax error unexpected View Forum Posts Member Join Date Sep 2006 Posts 28 Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION i keep running into this and been working on it for 2 months and still can't figure it out Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/under/public_html/kp/includes/inc-setup.php on line 16 PHP Code:
//include($incloc."includes/inc-config.php");
classmysql{
functionconnect()
{
//global$DB_INFO;
define('DB_NAME','under_rebels');
$connect=mysql_connect("localhost","under_nocause","buttercream");
mysql_select_db(