I can't ecplain it php related

Discussion in 'Programming/Scripts' started by tera7, Aug 10, 2008.

  1. tera7

    tera7 New Member

    Hello i had a php script that issued this mysql query :

    SELECT id, FROM table LEFT JOIN categories ON table.subcat =categories.subid WHERE maincat = '3' ORDER BY id DESC LIMIT 10;

    So after a mysql optimazation i changed the qurey.

    But i still getting this query to my slow log query file from mysql.

    it has been 4 days i changed the query but still i have it.
    What is going on?

    SOLVED google hit old scrpits
     
    Last edited: Aug 10, 2008
  2. ernstavbro

    ernstavbro New Member

    HELP re:pHP Scripts not displaying result

    Hi guys. I did not create a new thread, since the title of the thread is similar to what I am experiencing. tera7, may I use this thread? :)

    Okay. Here is the problem.
    I developed a simple program about 3 years back using Php+MysQL+Apache on Windows, using xampp...

    I got it to work back then. However, when I tried to test it again, using the same source, same SQL dump file from previous MySQL installation, I cannot make it work.

    I have a page that has links to itself, that when clicked, will execute a SELECT query to my MySQL database. It's like, a userID code that has the link to SELECT the full name for the userID. Before, I got it to work. When I see the complete URL from the browser, I can see that it "should" pass a value to the variable inside my script (e.g. http://localhost/srpt/index.php?iud=ernst098)

    My index.php script tests if iud has a value:
    <pre>
    .
    .
    if (iud){
    do something...
    }else{
    do other
    }
    </pre>

    The script always executes the else code, even if I click on different links for userID (the http://localhost/srpt/index.php?iud=xxxxx). The value for iud changes each time I click on a different user ID.

    I remember I changed something from the httpd.conf(?) file (I think it's related to what include-file-extensions) I will use for my programs... I used .inc for my "include" files. Is this the reason? Hmmnnn!!! I am confused, because, the index page displays what it's supposed to show to users, but the links... When I try to click them, it does not display the result of the SELECT query.

    The xampp version I used now is different. I am using xampp-win32-1.6.8-installer, as against an older xampp back then. I think it's xampp-win32-1.4xxx.... I think the php version back then was PHP4, and now, on this xampp-win32-1.6.8-installer installation, it's 5...

    Can somebody help me with this, please?
    Or is the information I posted lacking?
     
    Last edited: Nov 11, 2008
  3. Ben

    Ben Active Member Moderator

    at first the code should be "if( $uid )", you missed the $, for that you are referring to -> register_globals.

    As this is more than bad coding, use $_GET, $_POST or $_REQGEUEST super gloabl arrays instead.

    in your case, to get the value or just the fact uid was passed as a GET parameter this way:

    PHP:
    if( isset($_GET['uid']) ) {
     
    //code 
    }
    else {
     
    //more code
    }
    if you still want register gloabls, either activate this in your php generally or just activate it in your httpd.conf (or other .conf part of your apache, depending on your configuration) via php_admin_value (or php_admin_flag, not sure which one is the right here).
     

Share This Page