SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict itsource's Avatar
    Join Date
    Jun 2001
    Location
    Thailand
    Posts
    369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why deprecate mysql_db_query();

    This is my PHP code

    PHP Code:
        $query "select  something from x";
        
    $result mysql_db_query("mydatabase",$query);

        if (
    $result)   
        {
            while (
    $row=mysql_fetch_array($result))
            {
                
    $IDNews    =$row['IDNews'];
                
    $Headline    =($row['Headline']);
                
    $postdate    =($row['postdate']);
                print 
    "variable retrieve from query";
            }
        } 
    This code work well but when I'm format and Install windows and install php and mysql(3.23.43) again.
    There is warning

    PHP Code:
    Warningmysql_db_query is deprecated; use mysql_select_db() and mysql_query() instead in index.php on line 33 
    I live in Thailand. My English grammar not well.

  2. #2
    SitePoint Addict itsource's Avatar
    Join Date
    Jun 2001
    Location
    Thailand
    Posts
    369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I also have another question please


    (This code I use session)

    Warning: Cannot send session cookie - headers already sent by (output started at c:\xxx\interface.inc.php:2) in c:\xxx\accesscontrol.php on line 2
    I live in Thailand. My English grammar not well.

  3. #3
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,937
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you need to send your cookies before you send any output
    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums

  4. #4
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use mysql_select_db() and then mysql_query() just like it says.
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  5. #5
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    basically use this
    PHP Code:
    $connect mysql_connect(host,user,pw);
    mysql_select_db("db_name"$connect);

    // ...
    // to do your query 

    if(mysql_query($query))
    {
     echo 
    "it worked!";
    }
    else
    {
     echo 
    "it didnt work!";

    instead of this:
    PHP Code:
    $connect mysql_connect(host,user,pw);
    // ...

    if(mysql_db_query("dbname"$query$connect))
    {
     
    // blah blah

    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*


Bookmarks

Posting Permissions

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