Hi all,
I am using a custom made script that im still making and i want to refresh to a page pulled from a mysql db but i want it to refresh a page that stored as a php variable.
As long as nothing has been sent to the browser (no HTML, not even any blank spaces before the first <?php) then you can use the header() function to send a user to a different page.
If you have the URL you want to send them to in a variable called $send_url, for example, then the code would be:
PHP Code:
<?php
//NO BLANK SPACES OR HTML BEFORE FIRST TAG!
//Code here...
header("Location: ".$send_url);//Send them to $send_url
?>
$user = "stevengi_tut";
$password = "cobra";
$location = "localhost";
//only edit location if you have been told to do so.
$db = "stevengi_script";
mysql_connect("$location", "$user", "$password");
mysql_select_db("$db");
// 1. Clean $_GET vars first
$tutorial = (int) $_GET['tutorial'];
$select = mysql_query("SELECT * FROM tutorials WHERE id = '$tutorial' LIMIT 1");
while($row = mysql_fetch_array($select, MYSQL_ASSOC)) {
$url2 = $row['url2'];
}
?>
$time = "2";
$user = "stevengi_tut";
$password = "cobra";
$location = "localhost";
//only edit location if you have been told to do so.
$db = "stevengi_script";
mysql_connect("$location", "$user", "$password");
mysql_select_db("$db");
// 1. Clean $_GET vars first
$tutorial = (int) $_GET['tutorial'];
$select = mysql_query("SELECT * FROM tutorials WHERE id = '$tutorial' LIMIT 1");
while($row = mysql_fetch_array($select, MYSQL_ASSOC)) {
$url2 = $row['url2'];
echo '<meta http-equiv="refresh" content="2; url=. $url .">';
}
?>
If you typed the page address in the Address bar, make sure that it is spelled correctly.
Open the www.stevengibbons.com home page, and then look for links to the information you want.
Click the Back button to try another link.
Click Search to look for information on the Internet.