pass variables to a db function
Posted: Fri Jul 04, 2003 9:11 am
Hi there peeps,
I am a beginner and have a question: i have a database with hotels listed per country. I have a function which i'd like to use for all countries. However each countries hotels will be listed on its seperate page.
So basically i have an .inc file which has the generic db query something like this:
function showHotel($whichCountry)
global $whichCountry;
{
blah blah blah dbquery WHERE country=$whichCountry.
}
// then i call the query like so on my page hotels_spain.php:
// es for spain
<?php
showHotel("es");
?>
This should then translate to WHERE country=es.
However the variable whichCountry is always empty when it's called. Any ideas, i know its something simple but can remember how ;-0
Thanx
Lee
I am a beginner and have a question: i have a database with hotels listed per country. I have a function which i'd like to use for all countries. However each countries hotels will be listed on its seperate page.
So basically i have an .inc file which has the generic db query something like this:
function showHotel($whichCountry)
global $whichCountry;
{
blah blah blah dbquery WHERE country=$whichCountry.
}
// then i call the query like so on my page hotels_spain.php:
// es for spain
<?php
showHotel("es");
?>
This should then translate to WHERE country=es.
However the variable whichCountry is always empty when it's called. Any ideas, i know its something simple but can remember how ;-0
Thanx
Lee