SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2005
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    working out my hostname (is this a stupid question?)

    probably

    How can I work out the hostname of my server. For local scripts i can just use 'localhost', but not for my remote script. Is the hostname based on my URL?

    Also, will hosts generally allow scripts to access/ modify local databases, or will they normally not allow this?
    Rascal, am I? Take that!

    -Errol Flynn

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2005
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi chrisdb
    you can do this by
    Code:
    select * from mysql.users
    if you have permission to access it or by
    Code:
    reverse(substring_index(reverse(current_user()),_utf8'@',1))
    Chagh

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2005
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers chagh, but neither of those work. (First no permission, second generates error). Was the second one for MySQL or PHP?

    For this software im using i need the hostname and port number for my MySQL db. Can this information be derived from what is returned by running phpinfo()?
    Rascal, am I? Take that!

    -Errol Flynn

  4. #4
    SitePoint Enthusiast
    Join Date
    Jun 2005
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know about phpinfo but that function is for MySQL,
    you should "select reverse..."
    does it gives you an error when you use it in a select statement?

    Chagh

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2005
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i get:

    SQL-query: Documentation

    SELECT reverse( substring_index( reverse( current_user( ) ) , _utf8 '@', 1 ) )

    MySQL said: Documentation
    #1064 - You have an error in your SQL syntax near '()),_utf8'@',1))' at line 1
    Rascal, am I? Take that!

    -Errol Flynn

  6. #6
    SitePoint Enthusiast
    Join Date
    Jun 2005
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    which version of mysql do you use?
    CURRENT_USER() was added in MySQL 4.0.6. As of MySQL 4.1, the string has the utf8 character set.
    you can use USER() instead of current_user ,As of MySQL 4.1, USER() returns a value in the utf8 character set, so you should also make sure that the '@' string literal is interpreted in that character set.

    Chagh

  7. #7
    SitePoint Enthusiast
    Join Date
    Jun 2005
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, yes. See my other post "update if present else insert", i figured out today I'm on MySQL 3.23. Sorry for not mentioning it sooner.

    This sucks! I need to get my host to sort this out. Nothing anybody suggests works! How old is 3.23 now?
    Rascal, am I? Take that!

    -Errol Flynn

  8. #8
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by chrisdb
    How old is 3.23 now?
    too old


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
  •