cs1h Posted September 19, 2007 Share Posted September 19, 2007 Hi, I am using the get method on my form to send information to my proccesing script, but i don't know how to take the information from the url and so that i can search for it in the database using a piece of code like this, $sql = "SELECT * FROM items WHERE id=$art"; Can any one tell me how to do this, Cheers Colin Link to comment https://forums.phpfreaks.com/topic/69911-solved-how-to-get-information-from-url/ Share on other sites More sharing options...
Fadion Posted September 19, 2007 Share Posted September 19, 2007 <?php $art = $_GET['id']; $sql = "SELECT * FROM items WHERE id=$art"; $results = @mysql_query($sql) or die(mysql_error()); ?> Link to comment https://forums.phpfreaks.com/topic/69911-solved-how-to-get-information-from-url/#findComment-351144 Share on other sites More sharing options...
chocopi Posted September 19, 2007 Share Posted September 19, 2007 to get a info from the url you use $_GET http://www.somesite.com/index.php?art=hello <?php $art = $_GET['art']; $sql = "SELECT * FROM items WHERE id=$art"; ?> ~ Chocopi Link to comment https://forums.phpfreaks.com/topic/69911-solved-how-to-get-information-from-url/#findComment-351147 Share on other sites More sharing options...
redarrow Posted September 19, 2007 Share Posted September 19, 2007 @ <<<<< take that away what the point in the die then. Link to comment https://forums.phpfreaks.com/topic/69911-solved-how-to-get-information-from-url/#findComment-351149 Share on other sites More sharing options...
redarrow Posted September 19, 2007 Share Posted September 19, 2007 url example <?php example.php?id=$art ?> <?php if($_GET['id']=="$art"){ $x = $_GET['art']; $sql = "SELECT * FROM `items` WHERE id='$x'"; $results = mysql_query($sql) or die(mysql_error()); // echo required info. }else{ header("location: index.php"); exit; } ?> Link to comment https://forums.phpfreaks.com/topic/69911-solved-how-to-get-information-from-url/#findComment-351153 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.