posting null values in qty field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SSG001
    New Member
    • Oct 2007
    • 110

    posting null values in qty field

    i have a table

    prductcode qty
    qty fiels is decimal and it is not complusory

    so sometimes user can keep it blank
    so when i try for query to insert

    insert into table1(prductco de ,qty)values('$p cde',$qty);
    the i get error
    how i do this



    Thanks in advance
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Originally posted by SSG001
    i have a table

    prductcode qty
    qty fiels is decimal and it is not complusory

    so sometimes user can keep it blank
    so when i try for query to insert

    insert into table1(prductco de ,qty)values('$p cde',$qty);
    the i get error
    how i do this



    Thanks in advance
    Try this:

    [code=sql]

    insert into table1(prductco de ,qty)values('$p cde',ISNULL($qt y,0));

    [/code]

    Comment

    • SSG001
      New Member
      • Oct 2007
      • 110

      #3
      i tried but same still getting a error






      Thanks

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Originally posted by SSG001
        i tried but same still getting a error






        Thanks
        Could you please post what is your exact error?

        Comment

        Working...