Programming C# C++ (7) Delphi (618) Java (8) JavaScript (30) perl (9) php (4) GTK (2) VBScript (1) Visual Basic (1)
Exchange Links About this site Links to us 
New related comments Number of comments in the last 48 hoursFatal error: Call to undefined function: mysql_connect() 1 new comments
|
Getting started with php and mysql
This article has not been rated yet. After reading, feel free to leave comments and rate it.
You need a basic skeleton to access a mysql database with php? Take the piece from below and add what you need.
 | |  | | <?php
$link = mysql_connect("localhost", "user_name", "password")
or die("Could not connect : " . mysql_error());
mysql_select_db("database_name") or die("Could not select database");
$query = "INSERT into users (uname) VALUES ('John')";
echo "$query<br>\n";
mysql_query($query);
$query = "SELECT u_name, u_pass FROM users";
$result = mysql_query($query);
while ($row = mysql_fetch_row($result)) {
echo "\"$row[0],$row[1]\",<br>";
}
?> | |  | |  |
Comments:
|