I have php written in order for me to query information, however, I need to connect it to a certain website. This is what I have thus far.
[code=php] <html>
<head>
<title>Contact </title>
<link rel="stylesheet" href="eye01.css" type="text/css" />
</head>
<?php
$db = mysql_connect("localhost","root","");
if (!$db){
print "error - Could not connect to MySQL";
exit;
}
$er = mysql_select_db("touch_art1");
if(!$er){
print "error - Could not select the database";
exit;
}
$query = $query = "SELECT * FROM `sperm` WHERE year_left =".$year;
$query2= $query = "SELECT * FROM `cperm` WHERE year_left =".$year;
$result = mysql_query($query);
$result2 =mysql_query($query2);
//check to see if query worked
if (!$result)
{
echo "Query on Connection failed!";
// exit
}
else
{
echo 'succees';
// process results
while($row = mysql_fetch_row($result)) {
$date = $row[1];
echo "$date";
$name =$row[2];
echo"$name";
}
}
?>
</html>
</html>
Now, if I want it to go to a certain site, do I........
[code=php]//close connection
mysql_close();
header("Location: http://localhost/questions1.php")
?>
Could someone please clarify this for me? Also, when I make a query, do I need to set variables???