In that case all you need is something like the code below. This is a validation page for a login. The form passes the variables to this page, it does the queries and redirects depending upon the result. Hope this is more useful
$link=mysql_connect("server name","userid","password");
if (!$link)
die("Couldn't connect to MySQL");
mysql_select_db("dbname") or die ("Couldn't open Database");
$sql="SELECT * FROM ids WHERE username = '$userid' AND password = PASSWORD('$lpassword')";
$result=mysql_query($sql);
if (mysql_num_rows($result) == 1)
{
//initiate a session
session_start();
// register the user's ID
session_register("SESSION_UID");
list($id, $userid, $lpassword, $level) = mysql_fetch_row($result);
$SESSION_UID = $id;
//redirect to main page
header("Location:congrats.php");
mysql_free_result ($result);
// close connection
mysql_close($connection);
}
else
{
mysql_free_result($result);
// redirect to error page
header("Location:failed.php?error=4");
exit;
}