SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Digital Warrior Renegade's Avatar
    Join Date
    Nov 2000
    Location
    Portland, OR
    Posts
    480
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Resource Link Identifier

    ......What exactly is this? For instance, what does the variable $link do in the following code:

    $link = mysql_connect("host", "username", "pass");

    I have seen this same variable also used in mysql_select_db(); and mysql_query();

    The script seems to work with or without it. So why put it there?

    thanks
    --There's my 1.5 cents, now where is my change!?!?

  2. #2
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It will hold either 1 or 0 to show whether the connection was successful

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  3. #3
    Digital Warrior Renegade's Avatar
    Join Date
    Nov 2000
    Location
    Portland, OR
    Posts
    480
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Half right

    Here is a quote from the php.net docs on the mysql_connect() function:

    "Returns a MySQL link identifier on success, or FALSE on failure. "

    so its false if it fails, but then what is this link identifier for?

    It can also be used in the mysql_query() function, among others:
    PHP Code:
    $result mysql_query(" SELECT * FROM bob"$link); 
    I just dont' understand what the point of doing that is.
    --There's my 1.5 cents, now where is my change!?!?

  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)
    i never use the $link myself since for query(), select_db() and everything automatically use the last opened connection. unless somebody can tell me a good reason TO use it?
    - 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


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
  •