#1
  1. I love your chinese eyes :*
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jan 2006
    Location
    Her heart... she claims!
    Posts
    1,703
    Rep Power
    1054

    suddenly my mysql / mysqli functions stopped working


    Hi

    I have been working on an ERP project for the last one year. I had it tested intensively in
    past with huge test data and it worked beautifully. then I took a break of 2 years because of my business load.
    Now I have more time and I want to improvise few things in it to put it for free public use.

    However, I am not sure if too much has changed in these 2 years in PHP, but I am facing database query problems from my php code
    my first login query is not working. when I print the query and execute it in phpmyadmin it works fine and return result.
    but from my php code it is not working. I am using functions like

    mysql_num_rows()
    mysql_fetch_object()

    I modified the code to use mysqli class as follow

    PHP Code:
        $dbI = new mysqli($dbHost,$dbUser,$dbPassword,$dbName);


        if(!
    $result $dbI->query($sql_query)){
            die(
    'There was an error running the query [' $dbI->error ']');
        }
        echo 
    'Total results: ' $result->num_rows
    but it still gives 0 rows from the query that shows 1 row if i execute it directly from phpmyadmin.

    my php version is 5.2.2

    any wise words is highly appreciated.
  2. #2
  3. Headless Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,939
    Rep Power
    9647
    If you try fetching the results from the query, do you get anything?

    Also,

    UPGRADE! PHP 5.2.2 is so dead that you need archaeologists to deal with it. Move to PHP 5.6 or 7.
    Seriously. If you care about your codebase then you need to invest the time it takes to upgrade.

    Comments on this post

    • jojoba agrees : thank you
  4. #3
  5. I love your chinese eyes :*
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jan 2006
    Location
    Her heart... she claims!
    Posts
    1,703
    Rep Power
    1054
    ok, now I am seriously not happy. my server is with Hostgator.

    the code just started working. I even rolled back to my original code and even that is working fine now.

    I have wasted good 6 hours with this issue. I could have added a
    very nice container receiving feature in the stock menu.

    anyway, thank you. the mystery is solved.

IMN logo majestic logo threadwatch logo seochat tools logo