zero-perfoliate
zero-perfoliate

Author Topic: Parse error: syntax error, unexpected '"'  (Read 370 times)

Offline blazed

  • New PHP Members
  • Posts: 3
  • Karma: +0/-0
Parse error: syntax error, unexpected '"'
« on: February 19, 2009, 09:11:18 PM »
Hi there,

I purchased this script from someone but it is not working and this person has ignored my emails for about 4 months now.

So I'm hopping that a kind php pro can maybe help me fix this. This is a traffic trade script for a game site that displays games from friends sites.

Here is the db.php file.

Code: [Select]
<?php
 $dbhost 
'localhost';
 
$dbusername 'username';
 
$dbuserpassword 'password';
 
$default_dbname 'dbname';
 
$MYSQL_ERRNO '';
 
$MYSQL_ERROR '';
 function 
db_connect($dbname="$default_dbname") {
 global 
$dbhost$dbusername$dbuserpassword$default_dbname$dbname;
 global 
$MYSQL_ERRNO$MYSQL_ERROR;
 
$link_id mysql_connect($dbhost$dbusername$dbuserpassword);
 if(!
$link_id) {
 
$MYSQL_ERRNO 0;
 
$MYSQL_ERROR "Connection failed to the host $dbhost.";
 return 
0;
 }
 else if(empty(
$dbname) && !mysql_select_db($default_dbname)) {
 
$MYSQL_ERRNO mysql_errno();
 
$MYSQL_ERROR mysql_error();
 return 
0;
 }
 else return 
$link_id;
 } 
 function 
sql_error() {
 global 
$MYSQL_ERRNO$MYSQL_ERROR;
 if(empty(
$MYSQL_ERROR)) {
 
$MYSQL_ERRNO mysql_errno();
 
$MYSQL_ERROR mysql_error();
 }
 return 
"$MYSQL_ERRNO: $MYSQL_ERROR";
 }
?>


And here is the error I"m getting,

Parse error: syntax error, unexpected '"' in /home/username/public_html/directory/exchange/db.php on line 8

I have minimal understanding with php so an explanation may not help me, I would need to see the full code to the db.php file above with the correction if possible.

Any help would be really appreciated.

Offline PhPHelper

  • http://Digiscapers.com
  • Full Member
  • PHP Problem Solvers
  • ****
  • Posts: 179
  • Karma: +50/-0
    • Bad Apple Mail
Re: Parse error: syntax error, unexpected '"'
« Reply #1 on: February 20, 2009, 12:38:30 AM »
hi and welcome to the forum  :)

Not to sure whats causing the error but try this:

Code: [Select]
<?php
 $dbhost 
'localhost';
 
$dbusername 'username';
 
$dbuserpassword 'password';
 
$default_dbname 'dbname';
 
$MYSQL_ERRNO '';
 
$MYSQL_ERROR '';
 function 
db_connect($default_dbname) {
 global 
$dbhost$dbusername$dbuserpassword$default_dbname$dbname;
 global 
$MYSQL_ERRNO$MYSQL_ERROR;
 
$link_id mysql_connect($dbhost$dbusername$dbuserpassword);
 if(!
$link_id) {
 
$MYSQL_ERRNO 0;
 
$MYSQL_ERROR "Connection failed to the host $dbhost.";
 return 
0;
 }
 else if(empty(
$dbname) && !mysql_select_db($default_dbname)) {
 
$MYSQL_ERRNO mysql_errno();
 
$MYSQL_ERROR mysql_error();
 return 
0;
 }
 else return 
$link_id;
 } 
 function 
sql_error() {
 global 
$MYSQL_ERRNO$MYSQL_ERROR;
 if(empty(
$MYSQL_ERROR)) {
 
$MYSQL_ERRNO mysql_errno();
 
$MYSQL_ERROR mysql_error();
 }
 return 
"$MYSQL_ERRNO: $MYSQL_ERROR";
 }
?>


if that does not work come back and I'll try again.