How can I code this php statement and get one echo result?

Jonathan

New member
I've been trying to do this all day.... i have a list of tv shows and eps..
and i want the query to check if a season # is available.. and echo out the season #. One time.. yet i keep getting repeat echos.

<?php
$query = "SELECT id, season, episode FROM episodes WHERE id = $id AND season = 1 ";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
echo " season 1";
}
?>

how can i make it check if it's the right id and there's the chosen season #, and echo One Time!! Season 1, 2 etc.. just once instead of as many times as i have the season # in my field records.
i think it has sth to do with while($row = mysql_fetch_array($result))

simply put.. which other statement should i use
so the query will check if there's an existing record with season field = the #
and echo out what i want. that's it.
 
Back
Top