SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    625
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    bigint value as null

    hi

    i have a field name invoice_no defined as "bigint(20)" in my table and want to keep its default value as NULL.

    but it doesnt accept it.

    vineet

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,341
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    "doesn't accept" isn't a valid mysql error message

    please show what you tried, and the exact error message you got
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    625
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    This is the echo of my query
    Code:
    insert into mobile_table(mobile_date,waranty,invoice_no,make,model,imei,accessories,other_acc,faults,other_info,unique_id,customer_name,customer_address1,customer_address2,customer_contact_code,customer_contact,email,mode,payment_total) values('2010/04/28','No Warranty',,'LG','5421','12345678','1. Charge Stand      ','no','1. Water damage
    ','','015e44f6b3254dded0f6587abcd731ab','vineet','vineet kumar','india','03',123456,'vineet@yahoo.com','cash',20.00)
    the form doesnt gets submits.

    if the query is echoing the value of invoice_no as blank and in the database if the field is set as null, the form should get submit.

    if i insert the above through sql in databse directly then this error comes

    Code:
    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''LG','5421','12345678','1. Charge Stand      ','no','1. Water damage
    ','','015e' at line 1
    if i manaully write invoice_no and again submit the query then the error is gone

    vineet

  4. #4
    SitePoint Guru
    Join Date
    Jan 2004
    Location
    Uppsala, sverige
    Posts
    700
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Either omit the invoice_no column from the insert statement or use the keyword DEFAULT as a value in the values clause.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •