Jump to content

Archive:PHP and MySQL Programming/Database Connectivity

From IdeaWazaWiki
Revision as of 10:17, 21 March 2006 by wikademia>Ralfe

TOC


Introduction

Opening a Connection to a MySQL Database

<?
$db = "database1";
$link = mysql_connect("localhost", "username", "password");
mysql_select_db($db, $link);
?>

Creating a Query

<?
$query = $mysql_query("SELECT * FROM table1");
?>

Retrieving data from a SELECT Query

Closing a Database Connection

<?
mysql_close();
?>

<< 3. File Handling | TOC | >> 6. Session Handling