EvanAgee Posted November 3, 2008 Share Posted November 3, 2008 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! Link to comment https://forums.phpfreaks.com/topic/131134-just-moved-to-php5-and-having-odd-problems/ Share on other sites More sharing options...
genericnumber1 Posted November 3, 2008 Share Posted November 3, 2008 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. Link to comment https://forums.phpfreaks.com/topic/131134-just-moved-to-php5-and-having-odd-problems/#findComment-680893 Share on other sites More sharing options...
EvanAgee Posted November 3, 2008 Author Share Posted November 3, 2008 It ended up being a problem with register_long_arrays in php.ini. It was ignoring the array completely! I can't see how that would ever be useful to anyone, limiting array size. Changed, and problem fixed. Link to comment https://forums.phpfreaks.com/topic/131134-just-moved-to-php5-and-having-odd-problems/#findComment-680898 Share on other sites More sharing options...
kenrbnsn Posted November 3, 2008 Share Posted November 3, 2008 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 Link to comment https://forums.phpfreaks.com/topic/131134-just-moved-to-php5-and-having-odd-problems/#findComment-680916 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.