Help with registration script

Discussion in 'PHP' started by demondestiny, Sep 19, 2010.

  1. #1
    Hello i've got a registration script on my site but when the user enters there info and clicks register button it should take them to a page called process.php that congratulates them on registering. When it goes to the page process.php i get this error,

    Parse error: syntax error, unexpected T_STRING in /***/***/***/***/config.php on line 9

    Here is the code for config.php where the error is occuring. I assure you all my database information is correct but if anyone can spot the problem that would be great.

    
    <?php
    class MySQLDB
    {
       var $connection;         //The MySQL database connection
    
       /* Class constructor */
       function MySQLDB(){
          /* Make connection to database */
          $this->connection = @mysql_connect(localhost, ***, ***) or die(mysql_error());
          @mysql_select_db(***, $this->connection) or die(mysql_error());
        }
        /**
        * query - Performs the given query on the database and
        * returns the result, which may be false, true or a
        * resource identifier.
        */
        //Use this function as query("Query line of code");
       function query($query){
          return mysql_query($query, $this->connection);
       }
    };
    
    $config = new MySQLDB;
    ?> 
    
    Code (markup):
    Thanks.
     
    demondestiny, Sep 19, 2010 IP
  2. nabil_kadimi

    nabil_kadimi Well-Known Member

    Messages:
    1,065
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    195
    #2
    You need to replace *** with your database connection details:
    so instead of
          $this->connection = @mysql_connect(localhost, ***, ***) or die(mysql_error());
    PHP:
    you shoud have
          $this->connection = @mysql_connect('localhost', 'my_username', 'my_password') or die(mysql_error());
    PHP:
     
    nabil_kadimi, Sep 19, 2010 IP