Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Simple code

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Simple code

Postby tweaker » Mon Mar 24, 2003 10:06 am

I'm trying to figure out how to write a PHP script that will look at my MySQL DB for a record and then go directly to that URL. For instance if you put in the textbox "tweaker" and click submit, it looks in the database for the name "tweaker" and if it exists goes to the appointed location (URL). How would I start something like this? My homepage is a regular HTML page.
tweaker
New php-forum User
New php-forum User
 
Posts: 3
Joined: Mon Mar 24, 2003 10:02 am

Postby Skeletor » Tue Mar 25, 2003 4:58 am

This should be enough to get you pointed in the right direction.

to connect and search the database, you will have to use functions like:
mysql_connect();
mysql_select_db();
mysql_query();
etc...
These can all be found in the documentation at http://www.php.net

Once you find and retrieve the url from the database, you could redirect them to that url with the header(); function, such as:
header("location: http://www.link.com");
quit();
Skeletor
New php-forum User
New php-forum User
 
Posts: 147
Joined: Tue Nov 19, 2002 7:47 am
Location: US, Ohio


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot], Google Feedfetcher and 2 guests

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

cron