Binary Expressions

2005-8-9

PHP/MySQL Query Example

Filed under: — Adam @ 3:25 pm

A basic MySQL query using PHP with commenting marked with //.

// SQL statement that will be sent to the MySQL database server.
$szQry = “SELECT column1, column2 FROM foo”;

// MySQL database login credentilas; host (127.0.0.1), username and password.
$szDBConn = mysql_connect(”host”,”username”,”password”);

// Select database using the login credentials provided above.
mysql_select_db(”database_name”, $szDBConn);

// Send SQL statement to database.
$saResults = mysql_query($szQry, $szDBConn);

// Fetch results retured back from the SQL statement.
$obResults = mysql_fetch_row($saResults);

Comments are closed.

Take back your mailbox - CAUCE.org

Powered By Wordpress PHP: Hypertext Preprocessor MySQL Powered Download Juice, the cross-platform podcast receiver
Proud To Be Canadian Get Firefox Valid XHTML Valid CSS
<NO>OOXML Logo


25 queries. 0.239 seconds.
Copyright © 2004 - 2005 by Adam Douglas