Insert/Update

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • emm
    New Member
    • Nov 2006
    • 8

    Insert/Update

    Hello everyone! I am using PHP. I need to save data from <textarea> to MSSQL. I want that user will copy and paste data from MS Excel. I used the form method=Post. My data type is text with length 7000

    My problems are:

    1) Not all data posted is saved.
    2) When I try to edit the data through <textarea> then submit, data on the last row portion is lost. I can't trace why coz when I look in the database LongText is only I could see. I also tried viewing thru SQL Analyzer but only the first row of the data can be viewed.
    3) I tried searching and met the sp_tableoption , textinrow and @ptr. I dont understand how to use it.

    My codes for saving:
    $insert="INSERT INTO Itb (itbNo, myLongText) VALUES ('$itbNo', '$myLongText')" ;
    $result= mssql_query($in sert);

    My codes for updating:
    $update="UPDATE Itb SET myLongText='$my LongText' where itbNo = '$itbNo'";
    $result = mssql_query($up date);

    Anyone could please help? Thanks!
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by emm
    Hello everyone! I am using PHP. I need to save data from <textarea> to MSSQL. I want that user will copy and paste data from MS Excel. I used the form method=Post. My data type is text with length 7000

    My problems are:

    1) Not all data posted is saved.
    2) When I try to edit the data through <textarea> then submit, data on the last row portion is lost. I can't trace why coz when I look in the database LongText is only I could see. I also tried viewing thru SQL Analyzer but only the first row of the data can be viewed.
    3) I tried searching and met the sp_tableoption , textinrow and @ptr. I dont understand how to use it.

    My codes for saving:
    $insert="INSERT INTO Itb (itbNo, myLongText) VALUES ('$itbNo', '$myLongText')" ;
    $result= mssql_query($in sert);

    My codes for updating:
    $update="UPDATE Itb SET myLongText='$my LongText' where itbNo = '$itbNo'";
    $result = mssql_query($up date);

    Anyone could please help? Thanks!
    Check the structure of your table. What's the data type of column "myLongText "? Is it big enough to hold your entire text?

    -- CK

    Comment

    • emm
      New Member
      • Nov 2006
      • 8

      #3
      Originally posted by ck9663
      Check the structure of your table. What's the data type of column "myLongText "? Is it big enough to hold your entire text?

      -- CK
      Hi! The data type of "myLongText " is text and its Length is 7000. Enough to hold the text, i guess.

      I am also wondering why the data specifically on the last rows is lost. What I did was retrieve the data then save it. But when I retrieve again some data is lost.

      Help on this pls.

      Comment

      • ck9663
        Recognized Expert Specialist
        • Jun 2007
        • 2878

        #4
        Originally posted by emm
        Hello everyone! I am using PHP. I need to save data from <textarea> to MSSQL. I want that user will copy and paste data from MS Excel. I used the form method=Post. My data type is text with length 7000

        My problems are:

        1) Not all data posted is saved.
        2) When I try to edit the data through <textarea> then submit, data on the last row portion is lost. I can't trace why coz when I look in the database LongText is only I could see. I also tried viewing thru SQL Analyzer but only the first row of the data can be viewed.
        3) I tried searching and met the sp_tableoption , textinrow and @ptr. I dont understand how to use it.

        My codes for saving:
        $insert="INSERT INTO Itb (itbNo, myLongText) VALUES ('$itbNo', '$myLongText')" ;
        $result= mssql_query($in sert);

        My codes for updating:
        $update="UPDATE Itb SET myLongText='$my LongText' where itbNo = '$itbNo'";
        $result = mssql_query($up date);

        Anyone could please help? Thanks!
        Try to display the value of your $insert. Copy and paste it on Query Analyzer. Let's go from there.

        -- CK

        Comment

        • emm
          New Member
          • Nov 2006
          • 8

          #5
          Originally posted by ck9663
          Try to display the value of your $insert. Copy and paste it on Query Analyzer. Let's go from there.

          -- CK
          Hi! Yes, I copied and paste it on Query Analyzer.. and the query is successful. I dont know where to go from there. :-) I am stuck.

          Comment

          • ck9663
            Recognized Expert Specialist
            • Jun 2007
            • 2878

            #6
            Then it seems the problem happens when the data is being transmitted to sql-server, since your query is built properly, I'm not much of a PHP programmer, so I can figure out if your problem is in PHP or not.

            Sorry, not much help.

            -- CK

            Comment

            • emm
              New Member
              • Nov 2006
              • 8

              #7
              Yehey! Guyz, I got the answer on my problem why some data rows are missing even my SQL is correct. In my php.ini, I changed the default to maximum. :-)

              ; Valid range 0 - 2147483647. Default = 4096.
              mssql.textlimit = 2147483647

              ; Valid range 0 - 2147483647. Default = 4096.
              mssql.textsize = 2147483647

              Thanks everyone!

              Comment

              Working...