Jump to content


Photo

Mysql_connect


  • Please log in to reply
1 reply to this topic

#1 rite2inno

rite2inno
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 29 April 2006 - 01:13 PM

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'


#2 Ph0enix

Ph0enix
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts

Posted 29 April 2006 - 01:57 PM

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
<?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.");
?>

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.
[url=http://www.slimphoenix.com][/url]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users