Looking for experienced PHP programmer

Discussion in 'Programming' started by NotsoNoobie, Dec 1, 2007.

  1. #1
    I have a fairly urgent crisis on my website. I keep getting the following error in the PHP error logs -
    PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/XXXX/public_html/modules/name_file.php

    Along with this its obvious that mysql is not closing connections like it should and I'm getting a too many connections error. That's despite using mysql_close and shutting off persistent connections.

    This really needs expert attention. I've already tried someone with decent experience and he wasn't able to figure it out.

    Let me know if your interested. You'll definitely be compensated.
    Here is the code that the error message is pointing to:

    $select_user_name = sqlq("SELECT * FROM `users` WHERE id='".$GLOBALS['user_id']."'");
    WHILE($DATA_USER_NAME = MYSQL_FETCH_ROW($SELECT_USER_NAME))
    {
    $GLOBALS['user_name_comment'] = $data_user_name['1'];
     
    NotsoNoobie, Dec 1, 2007 IP
  2. ngcoders

    ngcoders Active Member

    Messages:
    206
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #2
    the value of user_id might be wrong ... are u validating it before passing it to the Query ?
     
    ngcoders, Dec 2, 2007 IP
  3. scriptman

    scriptman Peon

    Messages:
    175
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I assume you've got that one row capitalized for the sake of clarity? $select_user_name must obviously be lower case. Sounds like your query isn't returning a data set. You should root through your sqlq function and work out where it actually executes the query, and make sure any errors are dumped out.
     
    scriptman, Dec 2, 2007 IP
  4. nasty.web

    nasty.web Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    This code is wrong by itself.

    There is used a while block after a select form users table, notice the part where id is compared with some variable: does it mean that user id in that table is not unique??
    Later on in a while loop some kind of results is assigned to the same variable?? And for the God's sake why sql query result, which is an array is named $DATA_USER_NAME??

    Overall, it looks like some teen is learning mysql+php programming.
     
    nasty.web, Dec 3, 2007 IP