Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error message, but code does work as expected

    Hi all,

    After executing the following code:

    PHP Code:
       $conn = @mysql_pconnect($server,$user,$pass) or die ("unable to connect");
       
    $select mysql_select_db($database,$conn) or die ("unable to select db");
       
    $result=mysql_db_query($database"SELECT active,year,weekday,article,url FROM $table WHERE day = \"$day\" AND month = \"$month\" ORDER BY RAND() LIMIT 0,1"); 
    I get tese error messages:

    Deprecated: Function mysql_db_query() is deprecated in /home/user/domains/ZZZ.com/public_html/tih/test.php on line 42

    Deprecated: mysql_db_query() [function.mysql-db-query]: This function is deprecated; use mysql_query() instead in /home/user/domains/ZZZ.com/public_html/tih/test.php on line 42
    I am a newbee and consulted the web in order to try converting this code to mysqlli but did not succeed.

    All help will be appreciated

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,026
    Thanks
    23
    Thanked 588 Times in 587 Posts
    The manual is the best source for php information.
    How to connect to a database with the new mysqli is found here: http://www.php.net/manual/en/mysqli....onnections.php

    How to do a query is found here: http://www.php.net/manual/en/mysqli....statements.php

    If you still have problems post what your doing again.
    Evolution - The non-random survival of random variants.

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Funniest. Deprecation notice. Ever.
    Code:
     Deprecated: mysql_db_query() [function.mysql-db-query]: This function is deprecated; use mysql_query() instead in /home/user/domains/ZZZ.com/public_html/tih/test.php on line 42
    The irony here is that mysql_query is also now deprecated
    Check my sig on how to choose the proper replacement for the mysql library.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #4
    New to the CF scene
    Join Date
    May 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for all the help guys !


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •