Illyria Posted April 2, 2009 Share Posted April 2, 2009 Hi, I have a very basic webserver (win2k3, PHP & Mysql). I had older versions of PHP & Mysql and some connectivity from PHP to a Mysql database that worked ok. Then my PC crashed & burnt and I had to rebuild it. I have loaded the latest versions of PHP & Mysql and now I find that the code I have doesn't work as it used to. I have this command: $insert_data ="insert into << table >> (Field 1, Field 2, ..... )" ." values ('$Value1', '$Value2'..... )"; which includes data that is character, numeric and date. Now with the newer versions I have found that I just get an "cannot insert data" error. What I have found is that the dates no longer work as expected and if I ensure that the integer fields are not blank it seems to work OK. does anyone know what may have changed in the versions of PHP / Mysql or what I may have done incorrectly that has caused these commands to not work ? Quote Link to comment https://forums.phpfreaks.com/topic/152216-help-with-mysql-and-php/ Share on other sites More sharing options...
Illyria Posted April 2, 2009 Author Share Posted April 2, 2009 doh .. * your MySQL server version -- absolutely required! 5.0.51a ? * the raw MySQL statement in question [in a CODE block, and without any PHP variables] $insert_data ="insert into << table >> (Field 1, Field 2, ..... )" ." values ('$Value1', '$Value2'..... )"; * any errors that MySQL returns to the client [from mysql_error()] Not sure how to get this ?? * the table structure & column indexes of the relevant tables [via SHOW CREATE TABLE is preferred] * the EXPLAIN output for your query, if applicable Not sure what this means * a clear and concise description of what you want this statement to achieve Trying to insert data collected on a PHP page from site visitors into a Mysql database * a description of what it's currently doing that's not to your liking Not working * a brief listing of the types of things you've attempted so far hair pulling, expletive muttering. I removed all but one field and re-added them one by one. Without the integer fields and the date fields it seems to work OK. If I add the integer fields back and force them to have data in them (not blank) then it seems to work. Can't get the date fields going though. Quote Link to comment https://forums.phpfreaks.com/topic/152216-help-with-mysql-and-php/#findComment-799338 Share on other sites More sharing options...
fenway Posted April 2, 2009 Share Posted April 2, 2009 Sounds like you're in strict mode now. Quote Link to comment https://forums.phpfreaks.com/topic/152216-help-with-mysql-and-php/#findComment-799340 Share on other sites More sharing options...
Illyria Posted April 2, 2009 Author Share Posted April 2, 2009 You're right. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/152216-help-with-mysql-and-php/#findComment-799357 Share on other sites More sharing options...
Illyria Posted April 2, 2009 Author Share Posted April 2, 2009 can you recommend an appropriate setting for that option in the .ini file? Quote Link to comment https://forums.phpfreaks.com/topic/152216-help-with-mysql-and-php/#findComment-799373 Share on other sites More sharing options...
fenway Posted April 2, 2009 Share Posted April 2, 2009 can you recommend an appropriate setting for that option in the .ini file? Well, you can turn strict mode off -- at least back to the 4.1 settings -- but not sure that's what you want. Quote Link to comment https://forums.phpfreaks.com/topic/152216-help-with-mysql-and-php/#findComment-799637 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.