Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

Discussion in 'PHP' started by kiwigurlnz, Aug 8, 2011.

  1. #1
    I'm getting the following Error at my website:

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/vhosts/mydomain.com/httpdocs/classes/database.php on line 37

    Here is the code on line 37 

    include BASEPATH './config/database.php';
    Code (markup):
     

    Any help appreciated. 
     
    kiwigurlnz, Aug 8, 2011 IP
  2. artus.systems

    artus.systems Well-Known Member

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    103
    #2
    try this
    include BASEPATH.'./config/database.php';
    PHP:
     
    artus.systems, Aug 8, 2011 IP
  3. kiwigurlnz

    kiwigurlnz Member

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #3
    Ok this error is resolved.

    But now I have been given a user_fix.php to fix an error. This is the code within user_fix.php:

    <?php  include './classes/database.php';  $database = Database::get_instance();  $sql = "INSERT INTO `users` (`username`,`password`) VALUES ('admin','password1');";  if($database->query($sql, $link)) echo 'Successfully updated!'; else echo 'Error! '.mysql_error();
    Code (markup):
     

    Below is the following error I am getting when I go to mydomain.com/user_fix.php
     
    
    Warning: Database::include(BASEPATH/config/database.php) [database.include]: failed to open stream: No such file or directory in /var/www/vhosts/mydomain.com/httpdocs/classes/database.php on line 37  
    
    Warning: Database::include(BASEPATH/config/database.php) [database.include]: failed to open stream: No such file or directory in /var/www/vhosts/mydomain.com/httpdocs/classes/database.php on line 37  
    
    Warning: Database::include() [function.include]: Failed opening 'BASEPATH/config/database.php' for inclusion (include_path='.:/usr/share/php') in /var/www/vhosts/mydomain.com/httpdocs/classes/database.php on line 37  
    
    Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) in /var/www/vhosts/mydomain.com/httpdocs/classes/database.php on line 24 Could not connect to host.  
    
    Code (markup):
     

    HELP!! lol 
     
    kiwigurlnz, Aug 9, 2011 IP
  4. ausrixy

    ausrixy Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #4
    is simple the file you are trying to include is not there, the path to the file is wrong.
     
    ausrixy, Aug 10, 2011 IP