cerberus478 Posted November 18, 2011 Share Posted November 18, 2011 Hi I would like to know how to make a link select certain stuff from the database. For example the link called cape town with the id 11 is selected then the link must search through the events table for the city_id 11 and take that information and display it in another page. I would like to know how to do that or can you let me know of place that I can look. I have tried google but I don't know how to put what I'm looking for in words Quote Link to comment https://forums.phpfreaks.com/topic/251359-how-to-make-link-that-selects-certain-stuff/ Share on other sites More sharing options...
xyph Posted November 18, 2011 Share Posted November 18, 2011 In a PHP page, use the following code <?php echo $_GET['id']; ?> Call that page using page.php?id=7 Hope this is a good start. Keep in mind, a user can enter anything as ?id so you should verify that it contains a number before using it in a query. Quote Link to comment https://forums.phpfreaks.com/topic/251359-how-to-make-link-that-selects-certain-stuff/#findComment-1289212 Share on other sites More sharing options...
cerberus478 Posted November 18, 2011 Author Share Posted November 18, 2011 I get this error Warning: require_once(local.firecracker.co.za-404.html): failed to open stream: No such file or directory in /var/websites/local.firecracker.co.za/controller/seo_uris.controller.php on line 127 Fatal error: require_once(): Failed opening required 'local.firecracker.co.za-404.html' (include_path='.:/usr/share/php:/usr/share/pear') in /var/websites/local.firecracker.co.za/controller/seo_uris.controller.php on line 127 I have this in the listing.php page <?php $cities_model = new cities_model('cities'); $cities = $cities_model->get_all(); foreach($cities as $city){ $name = $city['name']; echo "<table>"; echo "<tr>"; echo "<td>"; echo "<a href=/events/view/".$city['id'].">$name</a>"; echo "</td>"; echo "</tr>"; echo "</table>"; } ?> and I have this in the view.php page [code] <?php echo $_GET['id']; ?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/251359-how-to-make-link-that-selects-certain-stuff/#findComment-1289215 Share on other sites More sharing options...
Zane Posted November 18, 2011 Share Posted November 18, 2011 So.. apparently after figuring out how to use $_GET variables, you received this error Warning: require_once(local.firecracker.co.za-404.html): failed to open stream: No such file or directory in /var/websites/local.firecracker.co.za/controller/seo_uris.controller.php on line 127 Fatal error: require_once(): Failed opening required 'local.firecracker.co.za-404.html' (include_path='.:/usr/share/php:/usr/share/pear') in /var/websites/local.firecracker.co.za/controller/seo_uris.controller.php on line 127 Which translates very easily to.. Warning: require_once(local.firecracker.co.za-404.html): failed to open stream: No such file or directory in /var/websites/local.firecracker.co.za/controller/seo_uris.controller.php on line 127 Quote Link to comment https://forums.phpfreaks.com/topic/251359-how-to-make-link-that-selects-certain-stuff/#findComment-1289217 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.