how to check for multiple occurences of a word??
Posted: Fri Apr 19, 2002 9:05 am
Hi, I'm at the beginning of try to write a little program to allow people to choose a team - it takes into account - name, position, value and country.
I've just started playing with sessions and stuff, the choices come from a MySql database, and I'm using a different page for each selection and carrying each variable forward with session_register() ideally once I have the selection I'll be putting into another table in the MySql database. First I have to check things out - eg the value of the selection - thats not a problem I'm simply using
BUT and this is my big problem, I'd like to limit people to selecting on a maximum of 3 from a particular country so by the time I'm done I'll have 11 variables for each county selection like so
$firstcountry
$secondcountry
$thirdcountry
$fourthcountry
$fifthcountry
and so on.
What is the best way to check out the values and number of occurences, like if china appears more than 3 times it would throw up an error message telling you that you have too many from the one country?
I haven't got a clue where to begin
I've just started playing with sessions and stuff, the choices come from a MySql database, and I'm using a different page for each selection and carrying each variable forward with session_register() ideally once I have the selection I'll be putting into another table in the MySql database. First I have to check things out - eg the value of the selection - thats not a problem I'm simply using
Code: Select all
if ($total > "150"){
die ("woah your selection cost to much");
}$firstcountry
$secondcountry
$thirdcountry
$fourthcountry
$fifthcountry
and so on.
What is the best way to check out the values and number of occurences, like if china appears more than 3 times it would throw up an error message telling you that you have too many from the one country?
I haven't got a clue where to begin