deprecated codes:

$query = "select * from categories where sub_cat_id = $selected ORDER BY `weight`, `name` ASC";
$result = [COLOR="Red"]mysql_db_query[/COLOR]($dbs["db_name"],$query,$conn) or die ("Error in query: $query.2" . mysql_error());

If I added mysql_select_db() and changed to mysql_query as suggested, Parse error comes out.
Warning: mysql_select_db() expects at most 2 parameters, 3 given in ...

Error in query: select from categories where sub_cat_id = 11 ORDER BY weight, name ASC.2

Note:
This code is working, only deprecated errors appeared.
This code used 3 parameters.
I have no right to access/modify PHP.ini file.

Hopes some can help me to solve this problem. Thanks in advance.

    Welcome to PHPBuilder! When posting PHP code, please use the board's [noparse]

    ..

    [/noparse] bbcode tags as they make your code much easier to read and analyze.

    As for your issue... show us the code you tried when you switched to first selecting the db and then using [man]mysql_query/man.

      code after modification:

      mysql_select_db($dbs["db_name"]);
      					$query = "select * from categories where sub_cat_id = $selected2 ORDER BY `weight`, `name` ASC";
      					$result = mysql_query($dbs["db_name"],$query,$conn) or die ("Error in query: $query.2" . mysql_error());

      The above code produce this error:

      Warning: mysql_query() expects at most 2 parameters, 3 given in ....
      Error in query: select * from categories where sub_cat_id = 13 ORDER BY weight, name ASC.2

      Please let me know if you need more info.

        As the error message clearly explains, [man]mysql_query/man only "expects at most 2 parameters" yet instead "3 [were] given."

        See the manual to learn how the function is to be used.

          Hint: you've already selected the database via the mysql_select_db() function. 😉

            Thanks for the hint.

            The warning error for mysql_select_db is already resolved.
            The error for $query = "select * from categories ... is haven't resolved yet.

              ruswady;10981626 wrote:

              The error for $query = "select * from categories ... is haven't resolved yet.

              There is no error on that line. The error is on the next line where you attempt to call [man]mysql_query/man.

              Read the error message, and then read my post above, and then read the manual for [man]mysql_query/man.

                As bradgrafelman said. Also,

                ruswady wrote:

                Please let me know if you need more info.

                The rest of the error message that starts

                Error in query: select * from categories where sub_cat_id = 13 ORDER BY `weight`, `name` ASC.2

                probably explains the error.

                  Before things get too confusing here, this command...

                  $result = mysql_query($dbs["db_name"],$query,$conn)
                  

                  ...should instead be...

                  $result = mysql_query($query, $conn)
                  

                  (There is no "database" parameter for the mysql_query() function, just the query and the (optional) DB connection resource.

                    Write a Reply...