Jump to content

dzelenika

Members
  • Posts

    229
  • Joined

  • Last visited

Posts posted by dzelenika

  1. OK

     

    The way You doing this is completely wrong.

    You do not have to use XML parser to read XML document.

    Use simpleXML instead.

    Example:

     

    $xml = simplexml_load_file('test.xml');
    foreach ($xml->story as $story) 
    { echo $story->headline, '<br />';
       echo $story->link, '<br />';
    }
    

  2. What amount of data you have to see the difference?

     

    It is possible that first script is slower because it is wandering between database reading and writing HTTP response, while second in first step only reads data from database and in second writes it...

  3. yes it does in a sense as it shows one way of organizing the hierarchical tree data. But that's done for me. And it works. Now I'm trying to COPY a node and all its children and it's that operation I'm having trouble conceptualizing.

    JR

    I think You are using bad tree logic. It is better to realize tree in one table with fields:

     

    node_id (PK)

    parent_id (ID of parent node)

    order (makes order between siblings from same tree level)

     

    Top nodes doesn't have parent_id

    Then make a recursive function which inputs top node of tree part which you want to copy.

    Function should collect all nodes which have provided parent_id, loop through nodes and call itself again for any node until node has descendants.

     

  4. Thanks dzelenika for your reply,

     

    but the PHP login code involves making correspondent entries into the site's MYSQL database and thus when the auto logout occurs that information must be saved on the database (i.e. time of logout).

     

     

    Now the PHP code for recording this info is already there, now what I wanted is additional code which will enable the logout to happen automatically without anyone having to click the page i.e. if the user returns, he will find himself logged out.

     

    Thanks again for the reply

    I think this is what you are looking for:

     

    <script type="text/javascript">
    var t=setTimeout("document.location=\"logoutPage.php\"",3600000);
    </script>
    

    In logoutPage you can log any information or do whatever you want without any click

     

  5. Both people who have tried my chat feature were using Firefox and i am using firefox too however it works fine for me. It was on a local server and ive uploaded it to an online server and it works ok, could that of been the problem?

     

    Javascript doesn't depends on server.

    The way you are checking pressed key is preferred in IE.

    I think, but not 100% sure, that onKeyPress should return value to indicate that handled event.

    Anyway look at:

     

    http://www.w3schools.com/jsref/jsref_onkeypress.asp

     

  6. In main program you can't see variables from function.

    The easiest way to see variables from outer program is to collect variables into array then return array. For example instead of:

     

    $shipping = number_format($shipping, 2, '.', '');

     

    you could wrote:

     

    $returnArray['shipping'] = number_format($shipping, 2, '.', ''); ....

     

    and at the end instead of:

     

    return $retStr;

     

    you could wrote:

     

    return $returnArray;

     

    In outer program you should call function like this:

     

    $arr = getShoppingCartInfo();

     

    to collect values grabbed in function.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.