Thread: can i do this?

    #1
  1. Born Looser
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    /root
    Posts
    272
    Rep Power
    173

    Unhappy can i do this?


    I am confused. I have a client who is good to me and has given me the permission to use his database ccount. But I have a problem Now. How I will be able to access database account of a site say www.onesite.com to www.secondsite.com

    I know there is a way. But I am unable to find Please help.
    Kumar Chetan Sharma
    -----

    _SelfProcclaimedGuru
    Hire a LAMP guy.
    To err is human. To blame your computer for your mistakes is even more human, it is downright natural.
  2. #2
  3. 11
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jul 2001
    Location
    Lynn, MA
    Posts
    4,635
    Rep Power
    83
    Well, this is very easy to do with perl and DBI, you just need to specify what host in your connect() statement.

    Oh wait, what's that your sig says?
  4. #3
  5. Born Looser
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    /root
    Posts
    272
    Rep Power
    173

    Can I do this with PHP?


    My question is now that can I do this with PHP?
    If yes then how?
    regarding my Signature. some of senior in forums used it . I tried and found one similar to mine and adopted it. U can also get it. And I am really inetrested in Learning Perl,C and C++. I ahve just learned PHP/MySQL/Little bit of(ASP)/HTML,JavaScript and Flash/Photoshop/Gimp and Can Use Linux
    Perl is high on my list and I want to Master it.
    Kumar Chetan Sharma
    -----

    _SelfProcclaimedGuru
    Hire a LAMP guy.
    To err is human. To blame your computer for your mistakes is even more human, it is downright natural.
  6. #4
  7. Born Looser
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    /root
    Posts
    272
    Rep Power
    173
    actually I tried this and failed badly
    PHP Code:
    mysql_connect("www.a.com""myusername""mypassword")
            or die(
    "Could not connect");
        
    mysql_select_db("mydatabase") or die("Could not select database"); 
    Now actually i have a site with mysql support and it uses mere 1% of its MySQL quotta. I want to use rest 99% on my another site. The problem is how come I connect to the server.
    (Due to some known/unknown reasons I am not mentioning my username passwords kind of things)

    Please help me.
    Kumar Chetan Sharma
    -----

    _SelfProcclaimedGuru
    Hire a LAMP guy.
    To err is human. To blame your computer for your mistakes is even more human, it is downright natural.
  8. #5
  9. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    62
    Generally, when you connect to MySQL on a remote server, you would want to connect to the remote IP address, rather than the website domain name. Also, MySQL has to be configured to allow remote access by this specific user.

    Thirdly, when using PHP to connect to MySQL and do queries, etc... it never hurts to actually get the error message, instead of just to echo some text:
    PHP Code:
    mysql_connect("xxx.xxx.xxx.xxx""myusername""mypassword")
            or die(
    "Could not connect" mysql_error());
        
    mysql_select_db("mydatabase") or die(mysql_error); 
    Now, if you get an error message, it might help explain the problem. I have left the "Could not connect" in there for a reason. Now, if you try to connect, and you have the wrong IP address, of course you will get no MySQL error at all, just the phrase "Could not connect". If you actually do manage to connect, but your username/password is wrong, or you don't have permission to access, the MySQL error message should explain this.

    Since this is a specific question, not a general one about database design, etc... you should go to the MySQL forum or the PHP forum for more help.
    The real n-tier system:

    FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

    Amazon wishlist -- rycamor (at) gmail.com
  10. #6
  11. Born Looser
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    /root
    Posts
    272
    Rep Power
    173

    Unhappy again


    I got following error very first time i tried this and again when i tried using IP

    Warning: Can't connect to MySQL server on 'XXX.XXX.XXX.XXX' (111) in /home/myfolder/dbconnstr.php on line 2

    Warning: MySQL Connection Failed: Can't connect to MySQL server on 'XXX.XXX.XXX.XXX' (111) in /home/myfolder/dbconnstr.php on line 2
    Could not connectCan't connect to MySQL server on 'XXX.XXX.XXX.XXX' (111)

    and i used this code
    PHP Code:
    <?php
    mysql_connect
    ("XXX.XXX.XXX.XXX""myusername""mypassword")
            or die(
    "Could not connect" mysql_error());
        
    mysql_select_db("bonn") or die(mysql_error);
    ?>
    I think It is due to rights. May be i don't have remote access permissions. I will look into mysql manual to check what permissions I have got.

    Thanx for help.
    (Can I move my thread to another forum)
    Kumar Chetan Sharma
    -----

    _SelfProcclaimedGuru
    Hire a LAMP guy.
    To err is human. To blame your computer for your mistakes is even more human, it is downright natural.
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    Bracknell
    Posts
    4
    Rep Power
    0

    Exclamation linking database to HTML


    Hi, Shelda

    I was wondering if you knew an easy way to link to a ms access query from an html page?
  14. #8
  15. Born Looser
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    /root
    Posts
    272
    Rep Power
    173

    may be a form will do


    Simply a form will do. May be there is another way but I surely Don't know and is unable to find.
    Kumar Chetan Sharma
    -----

    _SelfProcclaimedGuru
    Hire a LAMP guy.
    To err is human. To blame your computer for your mistakes is even more human, it is downright natural.
  16. #9
  17. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    Bracknell
    Posts
    4
    Rep Power
    0

    Smile


    Cheers Shelda
  18. #10
  19. Born Looser
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    /root
    Posts
    272
    Rep Power
    173

    Angry My ID is Shleda not Shelda


    When shalespere said whats in the name he had no Email ID or domain name. I do have one.
    My ID is Shleda not Shelda

    Thanx
    Kumar Chetan Sharma
    -----

    _SelfProcclaimedGuru
    Hire a LAMP guy.
    To err is human. To blame your computer for your mistakes is even more human, it is downright natural.
  20. #11
  21. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    Bracknell
    Posts
    4
    Rep Power
    0

    Unhappy


    sorry shleda
  22. #12
  23. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    Bracknell
    Posts
    4
    Rep Power
    0

    Unhappy me again!


    I can't work out how to link to the form!!

    PLEASE help/advise
  24. #13
  25. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    a northern town
    Posts
    74
    Rep Power
    13
    heatherhainey,

    You would have probably been better off creating a new post with a bit more information about your specific problem or needs, but I will tag on to this one...

    In order to connect to an access db, from a web page, you will need to use a server side scripting language, such as vbscript with a compatible web server, such as IIS, to create a web page to include the neccessary data connection and query functions to enable you to retrieve information from access and format it to the required output.

    The actual mechanics of this process are really out of the scope of a simple post, but I can offer some advice on sites to visit to read up on the technologies mentioned and to provide some tutorials to assist in getting you started down the right road.

    4guysfromrolla
    webmonkey
    aspfree
    asp101

    There are loads of resources on just these few sites, so they should answer most of your questions. Once you get working, if you have any problems, just ask, but please read the forum guidelines before posting.

    Hope this helps.

    Regards, Ed.
    /* measure twice, cut once */

IMN logo majestic logo threadwatch logo seochat tools logo