Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by LLLLLLL

  1. No, it was not aimed at you. It was aimed at the idiot who told me there was no passing by reference who made me start the thread. He sent me to a couple sites that made things unclear. I shouldn't have posted.


    Also, I disagree with your premise, however. Every language offers this feature and it's there for a reason. There are times when you need to modify a variable in a function.

  2. OK. I think maybe some server administrator just doesn't know what he's talking about, then.


    I don't have any call-time references (I assume this only means where & is in front of the calling function parameter, rather than only in the function declaration). I think this server admin doesn't know much about PHP.

  3. If this was covered elsewhere on the forums, I apologize but search isn't working at all. So I'll ask potentially again...


    function some_func( &$var ) {
    $var = 1;
    some_func( $var );
    // var is now 2


    Now I see that 5.4 has removed passing by reference? This is a little crazy, frankly, since all other languages have this feature and developers need it. Regardless, what is considered the standard way of writing this type of function now that it's no longer possible to use my example code here?

  4. Getting error 1064 on this. I don't really understand why:


    update ds
    set ds.status = 99
    from status ds
    join orders_products op on ds.order_prod_id = op.id
    join orders o on op.order_id = o.id
    and o.guid = 'someGUID'


    Trying to update fields in the "status" table when I know the GUID of an order.



    ORDERS table

    ORDERS_PRODUCTS table (fk to ORDERS)

    STATUS table (fk to ORDERS_PRODUCTS)


    What am I missing?

  5. I don't understand. Can you clarify why it works on one site but not mine?


    This is all the relevant code:


    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />

    <link rel="stylesheet" type="text/css" media="screen and (max-width: 740px)" href="assets/css/style_m.css" />

    <link rel="stylesheet" type="text/css" media="screen and (min-width: 741px) and (max-width: 900px)" href="assets/css/style.css" />



  6. I'm trying a basic CSS media query. I added these two lines to my file... they are essentially copied from another site, with the href being different and referring to actual files on my server.


    <link rel="stylesheet" type="text/css" media="screen and (max-width: 740px)" href="assets/css/style_m.css" />

    <link rel="stylesheet" type="text/css" media="screen and (min-width: 741px) and (max-width: 900px)" href="assets/css/style.css" />


    But this doesn't work for me at all. The result on my site is that the elements on the page act as if no CSS file is declared at all. Is there something more that I need to do?

  7. I have an HTML5 audio player that gets created dynamically. Elsewhere the variable is declared:

    var default_volume = 0.8;


    Then I set the volume for the player ...

    player.setAttribute( 'volume', default_volume );


    Debugging shows default_volume is 0.8, but once set, "volume" is changed to 1


    Why is there rounding? How can I make it maintain the value I chose?

  8. There are lots of form-validation discussions revolving around onsubmit versus onclick. This is not one of them, but it's related.


    I noticed something like this:


    <form method="post">
       <input type="submit" onclick="return validate_form()">


    So there's no "onsubmit" validation for the form, but the button's onclick is calling the function instead. This isn't the recommended way to do this validation, so it is said, because someone can press "enter" in another input field of the form, thus bypassing the "onclick" event of the button.


    But that's where my question comes in....

    1) I am pressing enter in a text box

    2) The "validate_form()" function is getting called anyway!


    Why would that be? Is there now built-in logic to some browsers to do this? Any other reason?


    Chrome's call stack shows that the onclick handler initiated the call to the function, but I pressed enter in a text box. So why did that handler get called?  (Chrome, IE, all the browsers do this.)


  9. So, I understand if I add the following, that other domains can use the script via AJAX:


    header("Access-Control-Allow-Origin: *");
    code that does something


    My question is: does this line have to be at the top of the file? Does it matter where this line is located?


    I was thinking of doing something that lets a user configure their software's "allowed" domains, so, something like this:


    $urls = db::some_query_to_see_allowed_origins();
    if ( !empty( $urls ) )
        header("Access-Control-Allow-Origin: $urls");
    code that does something


    Would something like this work?  I don't know at what point the "cross-domain" errors occur, so I don't know where the header line needs to be.


  • 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.