Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Parse error in database.php


bobeisenberg

Recommended Posts

I have been editing my catalog/admin/includes/functions/database.php file and am now getting the following error message.

 

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/bobnanne/public_html/catalog/admin/includes/functions/database.php on line 72

 

The edits I have done are down in line 150, so I don't think its anything I've done.

 

The offending line is

 

$query .= ''' . tep_db_input($value) . '', ';

 

and its context is:

 

   $query = substr($query, 0, -2) . ') values (';
  reset($data);
  while (list(, $value) = each($data)) {
	switch ((string)$value) {
	  case 'now()':
		$query .= 'now(), ';
		break;
	  case 'null':
		$query .= 'null, ';
		break;
	  default:
	 $query .= ''' . tep_db_input($value) . '', ';
		break;
	}
  }
  $query = substr($query, 0, -2) . ')';
} elseif ($action == 'update') {
  $query = 'update ' . $table . ' set ';
  while (list($columns, $value) = each($data)) {
	switch ((string)$value) {
	  case 'now()':
		$query .= $columns . ' = now(), ';
		break;
	  case 'null':
		$query .= $columns .= ' = null, ';
		break;
	  default:
		$query .= $columns . ' = '' . tep_db_input($value) . '', ';
		break;
	}

Can anyone help?

 

Many thanks.

 

Bob

Link to comment
Share on other sites

you need to escape the ' character...

 

try this:

 

$query .= '\'' . tep_db_input($value) . '\', ';

 

Luigi

 

Thank you, this did the trick.

 

I thought the problem could have been with the single quotes, but didn't know which to escape, and didn't want to do more damage.

 

Thank you again.

 

Bob.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...