Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Databasing
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 02-07-2010, 05:15 PM
  #1
alexishere
Novice (Level 1)
 
Join Date: Feb 2010
Posts: 1
iTrader: (0)
alexishere is an unknown quantity at this point
Parse error: syntax error, unexpected T_DNUMBER

Code:
Parse error: syntax error, unexpected T_DNUMBER in /home/a6989956/public_html/include/database.php on line 24
Can anyone please tell me whats wrong? Here is line a few lines


Code:
class MySQLDB
{
   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 MySQLDB(){
      /* Make connection to database */
      $this->connection = mysql_connect(hostname, username, ********) or die(mysql_error());
      mysql_select_db(database, $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;
      
      if(TRACK_VISITORS){
         /* Calculate number of users at site */
         $this->calcNumActiveUsers();
      
         /* Calculate number of guests at site */
         $this->calcNumActiveGuests();
      }
   }
line 24-25 is

Code:
$this->connection = mysql_connect(hostname, username, ********) or die(mysql_error());
      mysql_select_db(database, $this->connection) or die(mysql_error());
PLEASE HELP!

Last edited by Horus_Kol : 02-08-2010 at 04:26 PM.
alexishere is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-07-2010, 07:23 PM
  #2
tnowalk
Lord (Level 16)
 
tnowalk's Avatar
 
Join Date: Jul 2008
Location: New York
Posts: 554
iTrader: (0)
tnowalk will become famous soon enoughtnowalk will become famous soon enough
$this->connection = mysql_connect('hostname','username', '********') or die(mysql_error());

Wrap your host, username and password in quotes, otherwise the server thinks those are variables.

Best Regards,
Trevor
__________________
http://www.tkm-designs.com

Last edited by Horus_Kol : 02-08-2010 at 04:27 PM.
tnowalk is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-08-2010, 04:29 PM
  #3
Horus_Kol
Mod of the Underlay
 
Horus_Kol's Avatar
 
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 17,495
iTrader: (0)
Horus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of lightHorus_Kol is a glorious beacon of light
Also - you database name where you select the database needs to be in 's


Just a tip - while you have replaced your password... you probably shouldn't post information about your hostname, database or username either - you gave away 3 of the 4 things a hacker would need to break your database (and probably make your hosting service a very unhappy service)
__________________
New Photo Gallery: Modus InOperandi
Personal Blog: HorusKol
Articles on Programming and Development (PHP/HTML/CSS, C/C++, more): RandomTweak
Horus_Kol is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 03-01-2010, 04:41 PM
  #4
rootsAfrica
Catapulted
 
Join Date: Feb 2010
Posts: 8
iTrader: (0)
rootsAfrica is an unknown quantity at this point
Really helpful thread so I might bookmark it
rootsAfrica is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Reply
KEEP TABS
SPONSORS
 
Boxedart

 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 05:37 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.