Jump to content

Archived

This topic is now archived and is closed to further replies.

slate

PHP/Mysql not inserting null values!

Recommended Posts

In this piece of a line of code:

 

$result = sql_query(\"INSERT INTO map_points VALUES (\'$point_id\', \'$point_title\', \'$point_desc\', etc...

 

 

it $point_title is empty (null) in the form, and the default value is NULL, why is it being inserted as 0 into the database?

Share this post


Link to post
Share on other sites

Figured it out myself...

There\'s a bug in mysql (according to mysql.com) so I have to do this:

 

$valsToInsert = \"\";

 

if ($point_id != \"\")

{

$valsToInsert = $valsToInsert . \"\'$point_id\'\";

}

else

{

$valsToInsert = $valsToInsert . \"NULL\";

}

 

for each $string i need to check it.

Share this post


Link to post
Share on other sites

×

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.