SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2004
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    "mysql_close(): no MySQL-Link resource supplied" error message

    I get an error message saying:

    mysql_close(): no MySQL-Link resource supplied

    But it doesn't happen every time the script executes. I can't figure out when it does happen. Can somebody tell me what's going on and how to fix it? Thanks.

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    just don't include mysql_close();.

    I never use it, i don't know anyone who does.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    see the documentation for info and an example of how to use a function.

    youre getting that error because you didnt pass a link to the function. as the manual sais, if you dont pass a link, it uses the last opened connection. if you didnt open a connection, it tries to create one so it can close it(pointless).

    solution? dont use the function unless you have a connection to be closed, or just dont even close it, php will do it for you.
    read the manual.

  4. #4
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Only time to explicitly close the connection is if you have a script that will continue to execute for a long time after the DB connection is needed (e.g image processing, mailing, serving file download).
    Otherwise the connection is closed anyway.


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
  •