Jump to content

Mysql_connect


rite2inno

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'
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.