Jump to content

how to make link that selects certain stuff


cerberus478

Recommended Posts

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

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.

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]

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.