Jump to content

Just moved to php5 and having odd problems


EvanAgee

Recommended Posts

So this is my php:

 

$sql = "INSERT INTO $content_table (".implode(", ",array_keys($cFields)).", timestamp) values (".implode(", ",array_values($cFields)).", now())";

 

For whatever reason I'm getting this error:

 

An error occured when we tried to create the page. Please contact your system administrator. Here is the error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' timestamp) values (, now())' at line 1

Statement executed was:

INSERT INTO tiger2_content (, timestamp) values (, now())

 

HOWEVER, this worked fine under PHP4. Ideas? $cFields is obviously an array that I'm constructing dynamically using $_POST variable  values. Any help much appreciated!

Try

 

$sql = "INSERT INTO $content_table (".implode(", ",$cFields).", timestamp) values (".implode(", ", $cFields).", now())";

 

if that doesn't work you will want to track back the cFields variable to find if it's being set properly.

That's not what register_long_arrays controls.

 

Here's what php.net has to say about it:

Tells PHP whether or not to register the deprecated long $HTTP_*_VARS type predefined variables. When On (default), long predefined PHP variables like $HTTP_GET_VARS will be defined. If you're not using them, it's recommended to turn them off, for performance reasons. Instead, use the superglobal arrays, like $_GET.  This directive became available in PHP 5.0.0 and was dropped in PHP 6.0.0.

 

You should be using $_POST, $_GET, etc.

 

Ken

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.