By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,216 Members | 1,032 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,216 IT Pros & Developers. It's quick & easy.

Parse Errors are causing me a problem

P: 3
I don't know why I continue getting such errors .With this one I can't even locate where the problem is.Its a database class for accessing information from a website database.[php]
* Database.php

class Users
var $connection; //The MySQL database connection
var $num_active_users; //Number of active users viewing site
var $num_active_guests; //Number of active guests viewing site
var $num_members; //Number of signed-up users
/* Note: call getNumMembers() to access $num_members! */

/* Class constructor */
function Users(){
/* Make connection to database */
$this->connection = mysql_connect('localhost', 'root', 'password') or die(mysql_error())
mysql_select_db(Users, $this->connection) or die(mysql_error());

* Only query database to find out number of members
* when getNumMembers() is called for the first time,
* until then, default value set.
$this->num_members = -1;

/* Calculate number of users at site */

/* Calculate number of guests at site */
Now the error is :Parse error: parse error, unexpected T_STRING in c:\inetpub\wwwroot\croco\tserver\login system v.2.0\include\database.php on line 25
where line 25 is: mysql_select_db(Users, $this->connection) or die(mysql_error());

Please help me I'm tired of this and I need to move on
Thank you in advance
Feb 23 '07 #1
Share this Question
Share on Google+
2 Replies

Expert 2.5K+
P: 4,258
I am also tired, but mainly of members who do not enclose their code within php or code tags and make it real hard to read their code!

Before you post any further read the Posting Guidelines at the top of this forum!
And especially the part about enclosing your code within tags.

Feb 23 '07 #2

Expert 2.5K+
P: 4,258
These 2 consecutive statements will result in parse errors:

Statement 1:
$this->connection = mysql_connect('localhost', 'root', 'password') or die(mysql_error())
You must end a PHP statement with a semi column.

Statement 2:
[php]mysql_select_db(Users, $this->connection) or die(mysql_error());[/php]
Users is neither a variable nor a literal. You must code any of them here, so it is either $Users or "Users".

Ronald :cool:
Feb 23 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.