SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    a fresh, new start... dujmovicv's Avatar
    Join Date
    Aug 2006
    Location
    Earth
    Posts
    559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Passing a variable not working at Apache 2.2.21/PHP 5.3.8

    Hi All,

    I'm working on a script that uses the JQwidgets's grid framework. Instead of the pure .js files, I'm using .php files to generate the JS code. In some cases (when passing a variable through the $_GET command), the script does not work what it is supposed to because the variable is not passed to the other php script. It IS working on my other machine with Apache 2.2.9/PHP 5.2.6 that's why I thought it is a server issue. I even tried to replace the php.ini file at my machine with the newer version (Apache 2.2.21) and it WORKED.
    Here's the part of the script :
    PHP Code:
    var source =
                {
                    datatype: "json",
                    datafields: [
                         { name: 'id', type: 'number' },
                         { name: 'task_name', type: 'string' },
                         { name: 'task_worked_by', type: 'string' },
                         { name: 'task_id', type: 'number' },
                         { name: 'project_id', type: 'string' },
                         { name: 'task_notice', type: 'string' },
                         { name: 'task_cost', type: 'string' },
                         { name: 'units_spent', type: 'number' },
                         { name: 'units_label', type: 'string' },
                         { name: 'sub_total', type: 'string' },
                         { name: 'finished', type: 'number' },
                         { name: 'timestamp', type: 'string' }
                    ],
                    id: 'id',
                    url: '../grid/jqwidgets/controllers/project_details_controller.php?action=<?=$action;?>', 
                    
            deleterow: function (rowid, commit) {
                        // synchronize with the server - send delete command
                        var data = "delete=true&id=" + rowid;
                        $.ajax({
                            dataType: 'json',
                            url: '../grid/jqwidgets/controllers/project_details_controller.php?action=<?=$action;?>',
                            data: data,
                            success: function (data, status, xhr) {
                                // delete command is executed.
                    commit(true);
                            }
                        });
                    },
                };
    How can I change the script to pass the variable 'action' REGARDLESS of the server version and php.ini configuration? Is it possible at all?
    Thank you in advance.

    Full time ADMIN - art community
    Part time coder - dsign

  2. #2
    a fresh, new start... dujmovicv's Avatar
    Join Date
    Aug 2006
    Location
    Earth
    Posts
    559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Huh... Debugging line-per-line... It turned out this line caused the problem :
    PHP Code:
    $task_sub_total number_format($task_sub_total2',''.'); 
    I was trying to format the number to make it more readable... Is there a better method (which is not dependent on server/php.ini configuration) to format the number?

    Full time ADMIN - art community
    Part time coder - dsign

  3. #3
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,650
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Hi Dujmovicv!

    I'd looked at your thread yesterday and it appeared to be a PHP problem rather than server-related.

    Saying that, you indicate that $task_sub_total was in error but didn't show how/where it was used. Same comment, though, about $action in the first post. Before I get into a function, I ensure that all the output variables are set (preferably pre-entry so I'm never calling a variable which has not been set but at least initiated within the script so it can output something expected).

    To account for the different responses, there must be something in the configuration of your php.ini files which is initializing a variable on your behalf. In other words, try to get both php.ini files and compare with a product like WinMerge or BCompare for the answer (to the different responses).

    Sorry, that's the best I can offer with what you've provided.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

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