Why is it inserting 0's instead of blank spaces into my DB using php?

Posted by zeckdude on Stack Overflow See other posts from Stack Overflow or by zeckdude
Published on 2010-05-27T23:55:35Z Indexed on 2010/05/28 0:01 UTC
Read the original article Hit count: 119

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql