Jump to content

Help with mysql and php


Illyria

Recommended Posts

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 ?

 

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.