Jump to content

Archived

This topic is now archived and is closed to further replies.

rite2inno

Mysql_connect

Recommended Posts

I was just Experimenting on the tutorial I just read. ANd I found out I do not have a db.php file. Can someone please explain how I could go about this?

<?php

mysql_connect("localhost","username","password") or die ("Unable to connect to MySQL server.");
$db = mysql_select_db("name_of_database") or die ("Unable to select requested database.");
?>

But I am afraid I do not know how to replace the contants. Can some one do that for me?

The database username is "Clienty" and the password is "clienty"

But I do not know the host, or whta it looks like
Could this be it? *http://mysqladmin.fatcow.com/mysqladmin/main.php?*
OR *http://mysqladmin.fatcow.com/mysqladmin/db_details_structure.php?db=clienty*
what could be my local host? I need an example. if my site is abc.com

----------------------------------------------------------
Notin much'Just me'

Share this post


Link to post
Share on other sites
Ok i dont know much on php so i probably wont help a lot, but when iv used a webhost and created a database it has given me the server name. so for example im using freehostia so the servername they gave me was mysql2.freehostia.com. My username is Ph0enix and my password is Ph0enix2 and my database is Ph0enix_db. so when im connecting to my database i would put
[code]<?php

mysql_connect("mysql2.freehostia.com","Ph0enix","Ph0enix2") or die ("Unable to connect to MySQL server.");
$db = mysql_select_db("Ph0enix_db") or die ("Unable to select requested database.");
?>[/code]

I also had a website on tripod.lycos.co.uk and for that i just used "localhost" but sometimes you use "127.0.0.1" instead.

So just try a few different things and make sure you havent made little mistakes.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.