How does PHP write null values to the MySQL field? _php Tutorials

Source: Internet
Author: User
Problem:

When modifying house information, one field is the total number of floors floorall, which is an int field, allowing null
When the information is modified, if the value of this field is entered, a value is written to the database and Null is written to the database if no value is entered
How to do it?

That's what I wrote.
if ($floorall = = ") {$floorall =null;}
$db->query ("Updata tabel set floorall = ' $floorall '");
However, the value written in this way is 0 instead of NULL

Answer:

Hello, please execute the following statement:

Updata tabel Set floorall = null

http://www.bkjia.com/PHPjc/364368.html www.bkjia.com true http://www.bkjia.com/PHPjc/364368.html techarticle problem: When modifying house information, there is a field that is the total number of floors floorall, is an int field, allows to change information when the time is entered, if the value of this field, then write a value to the database ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.