NamePros.Com (http://www.namepros.com/)
-   CODE (http://www.namepros.com/code/)
-   -   Connect to a mysql Database using php (http://www.namepros.com/code/15448-connect-to-mysql-database-using-php.html)

adam_uk 10-24-2003 01:52 PM

Connect to a mysql Database using php
 
PHP Code:
<?

$username
= "username";
$password ="password";
$db = "db";

$conn = mysql_connect("localhost", "$username", "$password") or die(mysql_error());

mysql_select_db("$db", $conn) or die (mysql_error());


?>


Once you have php,mysql working you can add this to a php file to use the database

you may also need other tools such as phpmyadmin www.phpmyadmin.net to help generate the mysql queries and make/delete/edit/change databases

deadserious 10-30-2003 06:35 PM

Nice one! That was a definite needed code snippet around here. ... Thanks for sharing. :D

adam_uk 10-31-2003 09:35 AM

:)

surprised it wasnt already here

Phoenix 04-18-2004 02:07 PM

I am saving this page in my "Cool Sites" guide :D, cool reference if your in a hurry.


All times are GMT -7. The time now is 07:22 PM.
Site Sponsors
Advertise your business at NamePros

Powered by: vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0