View Single Post
  #10   Spotlight this post!  
Unread 29-02-2004, 20:45
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: Need Help with SQL

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)
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)