Welcome, Guest
  • Author Topic: AMF not allways working or my coding has a bug?  (Read 2627 times)

    Drumwerx

    • Jr. Programmer
    • **
    • Posts: 62
      • View Profile
      • Email
    I am not sure what it is but I have had my flash program working for a long time but did not notice this until someone emailed to let me know they never got there info.

    My program I developed used the newstore flash shopping cart and was re-done extensively to make our own Drum set builder software.
    Here is the link http://www.drumwerx.com/dreamkitbuilder.html

    Users use the builder and get what they want quoted on as far as a custom drum set.  I use AMF to get things from the database as well as some xml to load all of the flash pages in this swf.

    Then at the very end they click on a get quote button to have the flash swf do 4 things using php scripts connecting to the database.  What is strange is most of the time when you click on the button nothing happens.  I have a note at that button that says if you do not see 4 messages please click on the get quote button again. It then works fine.

    It will
    #1 update or insert the clients info(name, address and so on in the clients table). message #1 is either client inserted or client updated
    #2 inserts into the database drum set general info. message #2 kit inserted
    #3 inserts all the details of the drum set. message #3 is details inserted
    #4 send me an email. message #4 is email sent

    What I am also seeing is that 1 out of 3 times using the swf I do not get the email, #4, and do not have the details inserted in the 3rd script. 

    I am thinking that the insert into the details database table did not work and had errors but can't figure out what it is or where to look for the error or how to make an error show up in a log for me to see what I have to change in that php script to make this work.  This has to be it!!

    Here is the PHP script I have in #3.
    Code: [Select]
    function insertDetail($OrderID, $List) // List is a two dimensional array with FkProduct and Quantity
    {
    for ($i=0; $i<sizeof($List); $i++)
    $result = mysql_query("Insert into details values('".$OrderID."', '".$List[$i]['Shell']."', '".$List[$i]['TopHead']."',
    '".$List[$i]['BotHead']."', '".$List[$i]['Hoop']."', '".$List[$i]['Mount']."', '".$List[$i]['Bracket']."', '".$List[$i]['LugPos']."',
    '".$List[$i]['Options']."')");
    if(mysql_error()) return "error";
    else return $OrderID;
    }

    Either this is not getting $orderID or $list correctly or there is the wrong info in $list because of how they used the swf and I have a bug in my code someplace.

    If I could make something write to another file so I can see what is in it then I might be able to go back and fix what code I have done wrong to get it working correctly. 

    Is there a way to write this error to a sepearte file?

    help!!



    « Last Edit: 10/08/08, 14:07 by Jorge Solis »

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: AMF not allways working or my coding has a bug?
    « Reply #1 on: 10/08/08, 14:10 »
    To spot the bug you need

    1. Reproduce it
    2. Sniff the connection to get the error messages, I suggest http://www.charlesproxy.com

    Jorge

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: AMF not allways working or my coding has a bug?
    « Reply #2 on: 10/08/08, 14:12 »
    Forget to mention: nice work ;)

    Jorge

    Drumwerx

    • Jr. Programmer
    • **
    • Posts: 62
      • View Profile
      • Email
    Re: AMF not allways working or my coding has a bug?
    « Reply #3 on: 10/08/08, 14:43 »
    The problem is I never get the bug to show up when I use the software because I know exactly what to do to get the quote sent when using the flash swf.  I have tried to get it mess up but can never get it to do it. 

    It only messes up when another user uses it and I find out now by checking the 4 tables.  I will see the first 2 tables for the new user correct but the last 2 tables not there so it is diffently not getting something passed to it from the 2nd table or the info it has, is not correct because of how they used the swf.

    I can't use charlesproxy on their machines and wanting to put some kind of maybe output on the 2nd script and just wriet it to a file for a while so I cna see what it is doing or sending.

    I have the 4 scripts running in a row. The 1st script sneds a variable to the second. The second sends to the third and so on. 

    Is there another way to write this to a file somehow?


    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: AMF not allways working or my coding has a bug?
    « Reply #4 on: 10/09/08, 02:59 »
    The best way to debug, is writing some kind of history list.
    You can use a file, or a database table for this.

    I like using a database table, because then I can fast select a certain process, or some special entries of interest, even though there are hundreds of entries ;)

    if you use a debug switch parameter, you can switch this function on and off, which is nice in large developments.

    Code: [Select]


    if($debug){
        $history->write("Code:".$currentCode,$_SESSION['user'],now());
    }
    or alike on each point of interest.
    If you use a object oriented approach, like assumed above, you can just change the history class to fullfill further functions.
    happy flashing
    8)
    Ronald