Here is a quick run-down of how to query a MySQL Table, and use the results. Also I will toss in at the end how to update a row in a table.
First I would suggest having a config.inc.php3 file. This file will contain your MySQL username, password, database name, hostname, and connection info.
Here is what I mean.
config.inc.php3
$hostname = 'localhost';
$database_name = 'mydatabase';
$username = 'bob';
$password = 'billy';
$conn = mysql_connect ($hostname,$username, $password);
// END CONFIG
Now here is how to select information from a table. In this example the table is called user. It has the following fields:
userID, firstname, lastname, email
Here is the query (it will list ALL users in the table):
$query = "SELECT * FROM user";
$result = mysql_db_query($database_name, $query, $conn) or die ("Error goes here");
while ($r = mysql_fetch_array($result))
{
$userID = $r["userID"];
$firstname = $r["firstname"];
$lastname = $r["lastname"];
$email = $r["email"];
echo"$firstname $lastname $email";
}
That there will print the firstname, lastname, email FOR EVERY ROW.
Simple eh.
Now in your $query, you can do specific like saying WHERE userID='4'
That will select only the row where userID is 4
Now here is how to update a row. (example userID 4, we will change firstname Derek to Bob)
$query = "UPDATE user SET firstname='Bob' WHERE userID='4'";
mysql_db_query($database_name, $query, $conn) or die ("Error Message here");
Hope this helps. Any problems let me know.