Page 1 of 1

[PHP] Page To Navigate To URLs In MySQL Database?

Posted: Mon Dec 12, 2011 11:49 am
by aristide
OK. So need a page that navigates to all the links in a MySQL table one by one (In Popup, or anything). I already have a script to add the URL:

addurl.php:

Code: Select all

<?
include("header.php")
?>
<form action="msgurl.php" method="post">

<table border="0"> 

<tr><td colspan=2 align="center"><h1>Add A New URL</h1></td></tr> 

<tr><td>Username:</td><td> 

<input type="text" name="username" maxlength="40"> 

</td></tr> 

<tr><td>URL:</td><td> 

<input type="text" name="url" maxlength="200"> 

<tr><td colspan="2" align="right"> 

<input type="submit" name="submit" value="Submit"> 

</td></tr> 

</table> 

</form> 


and msgurl.php

Code: Select all

<?
$host="localhost";
$user="xxxxxxx";
$pass="xxxxxxx";
$database="xxxxxxx";

$username=$_POST['username'];
$url=$_POST['url'];

mysql_connect($host,$user,$pass);
mysql_select_db($database) or die("Database Not Found");
$query = "INSERT INTO url VALUES ('','$username','$url')";
mysql_query($query);
mysql_close();
echo "You have added the URL succesfully! Click <a href=members.php>here</a> to return to the members area."
?>
What would the code for the autoviewer be? I'd like something like a page where it opens another page with already navigating to an URL, closes it and opens another page with the next URL. I know this is difficult :( but i even know its possible. Is anyone able to help me?

Re: [PHP] Page To Navigate To URLs In MySQL Database?

Posted: Mon Dec 12, 2011 12:24 pm
by mikeashfield
A foreach loop should do the trick. Google that, and the PHP header function and you should be away to go. :)

Re: [PHP] Page To Navigate To URLs In MySQL Database?

Posted: Mon Dec 12, 2011 12:44 pm
by aristide
mikeashfield wrote:A foreach loop should do the trick. Google that, and the PHP header function and you should be away to go. :)
I have googled what you have said, but i can't seem to understand clearly. And vb.net keeps popping up in my head :( I don't think i know what a php header is also. Is it a thing to make the webpage navigate to that thing when an action is completed?