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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aristide
Forum Newbie
Posts: 2
Joined: Mon Dec 12, 2011 11:35 am

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

Post 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?
mikeashfield
Forum Contributor
Posts: 159
Joined: Sat Oct 22, 2011 10:50 am

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

Post by mikeashfield »

A foreach loop should do the trick. Google that, and the PHP header function and you should be away to go. :)
aristide
Forum Newbie
Posts: 2
Joined: Mon Dec 12, 2011 11:35 am

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

Post 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?
Post Reply