I have an insert:
$sql = 'INSERT into orders SET
fax_int_prefix = "'.$_SESSION['fax_int_prefix'].'",
fax_prefix = "'.$_SESSION['fax_prefix'].'",
fax_first = "'.$_SESSION['fax_first'].'",
fax_last = "'.$_SESSION['fax_last'];
The value of all of these fields is that they are blank right before the insert. Here is an example of one of them I echo’d out just before the insert:
$_SESSION[fax_prefix] =
For some reason it inserts the integer 0, instead of a blank value or null, as it should. Why is it inserting 0’s instead of blank spaces into my DB?
Check the structure of your table. It’s possible that it is not of type
charorvarchar(or that it is and has a default value set to ‘0’). To do this you can use phpmyadmin, SQLyog or other MySql admin programs.Edit: If you want to store integers, but have the option of no value then make sure the type is nullable. i.e.:
column_name INT(n) DEFAULT NULL