Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

need some help

General discussions related to php

Moderators: macek, egami, gesf

Postby bezmond » Tue Jul 01, 2003 1:33 pm

Hello,

I have a short domain name that I would like to use for all of my linking.

Let's say the domain is dom.com and I want dom.com/link2 to be able to access my sql database pull up the 'link2' link, which let's say is somebigdomain.com/link.php and then automatically redirect me to that url.

Does anybody know on how I can accomplish this?

Thanks,


If you are specifically using a folder, e.g. domain.com/page/, then you can:
Code: Select all
<?
//Connect to your DB...
$page = $PHP_SELF;
$query = "select * from table where url='$page'";
//I've assumed that 'url' is the field name for where the redirec page is called
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$url = $row["url"];
}
//two options, you can use:
header("Location: $url");
//OR
include($url);
//The first will completely go to that page, the second will just display it inside your website.
?>


Regards,
Andrew
User avatar
bezmond
Moderator
Moderator
 
Posts: 312
Joined: Sat Apr 05, 2003 4:33 am
Location: Mansfield, UK

Return to PHP General

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.