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'];
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.
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.