Simple code

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

tweaker
New php-forum User
New php-forum User
Posts: 3
Joined: Mon Mar 24, 2003 10:02 am

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.

User avatar
Skeletor
New php-forum User
New php-forum User
Posts: 147
Joined: Tue Nov 19, 2002 7:47 am
Location: US, Ohio
Contact:

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();


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest

cron