tmharrison Posted February 4, 2007 Share Posted February 4, 2007 My database has the id_num and full url of a web page I want a field on a web page so that if someone enters this id_num that it takes them to the associated web page that is in the database. I have been reading Larry Ullman's PHP and MySQL book for a week i know that one of the answers will be the header() function, but I don't understand how to query the database and then keep that information and then use it in the header function. I know this is probably something that is simple but, I just can't see it. Thank you in advance for helping me out. Tina Link to comment https://forums.phpfreaks.com/topic/37064-new-to-phpmysql-how-to-query-database-then-use-the-found-data/ Share on other sites More sharing options...
Tandem Posted February 4, 2007 Share Posted February 4, 2007 <?php $id_num = $_POST['id_num']; $get_url = mysql_query("SELECT url FROM TABLE WHERE id_num='$id_num'"); $url = mysql_result($get_url, 0); header("Location: $url"); ?> You should be able to adapt that to your needs. Link to comment https://forums.phpfreaks.com/topic/37064-new-to-phpmysql-how-to-query-database-then-use-the-found-data/#findComment-177022 Share on other sites More sharing options...
tmharrison Posted February 4, 2007 Author Share Posted February 4, 2007 Thank you so much for the quick answer. I will try it and see if I can make it work. Thank you again! Link to comment https://forums.phpfreaks.com/topic/37064-new-to-phpmysql-how-to-query-database-then-use-the-found-data/#findComment-177023 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.