Jump to content

LLLLLLL

Members
  • Posts

    306
  • Joined

  • Last visited

Posts posted by LLLLLLL

  1. On one customer website, the customer cannot insert any rows if a field is left blank and the column is a number. In short...

    ''

    ... is not being accepted for numeric or decimal columns.

     

    I've never had this on any other customer site, and it's pretty standard to use '' for column values in by MySQL (and even MS-SQL).

     

    What would be preventing this? I assume it's a MySQL setting somehow? For what it's worth, this customer is on a Windows server, much to my chagrin.

  2. This is a fairly typical piece of AJAX code...

     

    $.get( "someurl.php", {
     param1: someVariableValue,
     param2: 'someHardCodedString'
     },
     function( data ) {
    

     

    On the back-end, PHP will receive $_GET with "param1" and "param2" keys, and the values as displayed above.

     

    My question is if it's possible to set the name of the keys param1 and param2 dynamically. I'm looking for a way to have a single function make the ajax calls, and to do that I won't have hard-coded "param1" keys, but the keys will be generated from whatever code I'm using to make the call. (Does that make sense?)

     

    Anyway, I am just looking for a way to set the keys of the GET (or POST) without hard-coding them on the page. Is this possible?

  3. I don't have HTTP_ORIGIN in the requests. I've tested on my server and a couple customers. This won't work as a solution.

     

    So two questions:

    1) What is the expected format to list domains? Comma-separated? Space-separated? Some server setting that determines the separation? It should work.

    2) Can I put multiple headers like this? Is it expected and/or good practice?

     

     

    <?php

    header("Access-Control-Allow-Origin: http://website.com");

    header("Access-Control-Allow-Origin: http://www.website.com");

  4. What is the correct syntax for listing multiple domains to be allowed for cross-domain AJAX calls? My code does this:

     

    <?php
    header("Access-Control-Allow-Origin: http://website.com");
    

     

    This works when website.com is the caller, but not when www.website.com is the caller. So I tried:

     

    <?php
    header("Access-Control-Allow-Origin: http://website.com http://www.website.com");
    

     

    ... and...

     

    <?php
    header("Access-Control-Allow-Origin: http://website.com, http://www.website.com");
    

     

    But these things don't work. When I say they don't work, I mean that neither website.com nor www.website.com will be able to make the call with those configurations. So right now the only option is to put * and allow everything. I don't want to do that.

     

    Is there another header directive or something that I need? I saw something about Access-Control-Allow-Headers: X-Requested-With but that didn't work either.

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

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

  7. 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++;
    }
    
    $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?

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

     

    Relationship:

    ORDERS table

    ORDERS_PRODUCTS table (fk to ORDERS)

    STATUS table (fk to ORDERS_PRODUCTS)

     

    What am I missing?

  9. 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" />

     

     

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