Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2004
    Posts
    67

    I am not seeing it but the mistake is there

    First crack at this and followed it through to the end, but it is not putting the data into the DB file. The dummy line I wrote directly in is showing in the list.box, but not the entered data into the form.




    function PopLBFromDB()
    tbReturn =SQLite.QueryToTable(db, "SELECT * FROM signup");

    --clear items from listbox
    --ListBox.DeleteItem("LB", LB_ALLITEMS);
    --do the following if there are rows
    if tbReturn and tbReturn.Rows > 0 then
    for i,v in tbReturn.Data do
    ListBox.AddItem ("LB", tbReturn.Data [i]["FIRST_NAME"], tbReturn.Data [i]["LAST_NAME"], tbReturn.Data [i]["ADDRESS"], tbReturn.Data [i]["ADDRESS2"], tbReturn.Data [i]["TOWN"], tbReturn.Data [i]["PROV_ST"], tbReturn.Data [i]["COUNTRY"], tbReturn.Data [i]["POSTAL"], tbReturn.Data [i]["DAY"], tbReturn.Data [i]["NIGHT"], tbReturn.Data [i]["EMAIL"], tbReturn.Data [i]["EMAIL2"], tbReturn.Data [i]["PASS"], tbReturn.Data [i]["PASS2"], tbReturn.Data [i]["SUBSCRIPTION"]);
    end
    end
    end

    function Enclose(strText)
    return string.format("%q",strText);
    end

    function AddtoDB()
    local strFIRST = Input.GetText("FIRST");
    local strLAST = Input.GetText("LAST");
    local strADDRESS = Input.GetText ("ADDRESS");
    local strADDRESS2 = Input.GetText ("ADDRESS2");
    local strTOWN = Input.GetText ("TOWN");
    local strPROV = Input.GetText ("PROV");
    local strCOUNTRY = Input.GetText ("COUNTRY");
    local strPOSTAL = Input.GetText ("POSTAL");
    local strDAY = Input.GetText ("DAY");
    local strNIGHT = Input.GetText ("NIGHT");
    local strEMAIL = Input.GetText ("EMAIL");
    local strEMAIL2 = Input.GetText ("EMAIL2");
    local strPASS = Input.GetText ("PASS");
    local strPASS2 = Input.GetText ("PASS2");
    local strSUBSCRIPTION = Input.GetText ("SUBSCRIPTION");
    --if strFIRST ~= "" and strLAST ~= "" and strADDRESS ~= "" and strADDRESS2 ~= "" and strTOWN ~= "" and strPROV ~= "" and strCOUNTRY ~= "" and strPOSTAL ~= "" and strDAY ~= "" and strNIGHT ~= "" and strEMAIL ~= "" and strEMAIL2 ~= "" and strPASS ~= "" and strPASS2 ~= "" and strSUBSCRIPTION ~= "" then
    result = Dialog.Message("Welcome ", Enclose(strFIRST)..Enclose(strLAST)..Enclose(strSU BSCRIPTION));
    --insert data into database db
    SQLite.Query(db, "Insert into signup(FIRST, LAST, ADDRESS, ADDRESS2, TOWN, PROV, COUNTRY, POSTAL, DAY, NIGHT, EMAIL, EMAIL2, PASS, PASS2, SUBSCRIPTION) values("..Enclose(strFIRST)..", "..Enclose(strLAST)..", "..Enclose(strADDRESS)..", "..Enclose(strADDRESS2)..", "..Enclose(strTOWN)..", "..Enclose(strPROV)..", "..Enclose(strCOUNTRY)..", "..Enclose(strPOSTAL)..", "..Enclose(strDAY)..", "..Enclose(strNIGHT)..", ".. Enclose(strEMAIL)..", "..Enclose(strEMAIL2)..", "..Enclose(strPASS)..", "..Enclose(strPASS2)..", "..Enclose(strSUBSCRIPTION)..")",nil);
    --Application.GetLastError ()

    --else
    --result = Dialog.Message("Notice", "You must enter all of the fields of information before you can continue with the signup process", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);


    end


    thanks for any help
    Last edited by synistics; 03-26-2007 at 05:23 AM. Reason: add thank you

  2. #2
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    The ListBox.AddItem only allows three parameters. You are tyring to put everything into the listbox as if it were a grid. What do you actually want to display in the listbox? Do you want to show everything like a spreadsheet, if so then I would look at the Datagrid plugin from IcyNorth. Or if you only want first name and last name then concatenate those items together in the text section and put a unique id into the Data portion like this.

    ListBox.AddItem ("LB", tbReturn.Data [i]["FIRST_NAME"] .." ".. tbReturn.Data [i]["LAST_NAME"], tbReturn.Data [i]["UNIQUE_KEY"]);

    This of course assumes that you have a unique ID for each row in the database.

    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  3. #3
    Join Date
    Feb 2004
    Posts
    67

    thanks Tigg

    I should have explained better but exhaustion was getting me.

    The box, which thank you is one thing, the issue is that on hitting the button on the my page, the list box is added another representation of the dummy data I manually inserted through SQLite browser.

    When checking the DB with Browser, the new data entered has not been added into the DB. The display in list box is for me right now and yes going forward I want may want to use it for a verification and have the user agree and then submit the information to the server via php or I may just make that function flow straight through and keep a copy local and send up to the server with the same button push.

    Right now, there is nothing to send, because it just is not getting added to DB.

    Thanks

    Synistics

  4. #4
    Join Date
    May 2006
    Posts
    5,380
    ok, heres what i would do

    finish your error checking ie:

    --Application.GetLastError ()-- replace this line of code with the below code


    Code:
    error = Application.GetLastError();
    if (error ~= 0) then
        Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
    end
    then try and add the data to the database again


    my bet is that you will get "SQL Logic or missing database error"

    if so, check the order of your sql query, it must match the order in wich you created the database
    Open your eyes to Narcissism, Don't let her destroy your life!!

  5. #5
    Join Date
    Feb 2004
    Posts
    67
    Quote Originally Posted by RizlaUK View Post
    ok, heres what i would do



    then try and add the data to the database again


    my bet is that you will get "SQL Logic or missing database error"

    if so, check the order of your sql query, it must match the order in wich you created the database
    off to check will post outcome

    thanks

  6. #6
    Join Date
    Feb 2004
    Posts
    67

    error in field names

    I had made a change on the action page expanding names from FIRST to FIRST_NAME, followed it through to the list box, but no further. Reverting back to the simple name populates the database and now I am ready for the next mountain to climb

    Thanks all for the help

Similar Threads

  1. 300+ Pages and One Mistake
    By jman in forum AutoPlay Media Studio 5.0
    Replies: 2
    Last Post: 06-14-2005, 01:21 AM
  2. project timer
    By petervb in forum AutoPlay Media Studio 4.0
    Replies: 7
    Last Post: 12-22-2004, 10:45 AM
  3. Big Mistake with Legall rights
    By An in forum AutoPlay Menu Studio 3.0
    Replies: 1
    Last Post: 05-09-2001, 04:24 PM

Posting Permissions

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