Quote:
|
Originally Posted by Raven_Writer
Just for the record, it depends on how you'd like to connect to the db on how many lines it'd take.
Here's the smallest way to connect to a db IMO (incase you are having trouble with connecting):
PHP Code:
<?php
$db = mysql_connect_db("localhost", "fred", "loves_wilma");
mysql_connect($db);
mysql_close();
?>
It may not be totally correct syntax, but that's because I haven't touched PHP in a while
|
PHP Code:
<?php
mysql_connect("dbhost","dbuser","dbpass") or die("could not connect to db";
mysql_select_db("dbname") or die("could not select database");
$result = mysql_query("query string") or die("could not query database");
//process data
?>
(php automatically closes the database connection at the end of the script)