nita Posted June 11, 2007 Share Posted June 11, 2007 Hi I'm building photo gallery .. and i got stuck at one point. There is a code.. $session=$_GET['session']; $result = mysql_query("SELECT * FROM session WHERE session='$session' LIMIT 1"); // printing out country of the current session while ($row = mysql_fetch_array($result)) { echo " <span class='info1'>"; echo $row['country']; echo "<br><br></span>"; } // this is a part im not sure of .. $row = mysql_fetch_array($result); $row['country'] = $country; // printing out all the sessions in current country $result = mysql_query("SELECT * FROM session WHERE country='$country' ORDER BY year DESC") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { echo "<span class='links1'><A href='ontheroad.php?session=$row[session]'>$row[session]</a></span><br>"; } Wht i want to do is .. when i choose photo session, browser will print the menu - 1st query containg name of the country, based on selected session 2nd query will print all the sessions that are in selected country. There is no problem to print out country, but i think is something wrong with passing varaible $country What do i do Wrong? Help Please. Nita Quote Link to comment https://forums.phpfreaks.com/topic/55063-solved-mysql-based-menu-problem/ Share on other sites More sharing options...
csplrj Posted June 11, 2007 Share Posted June 11, 2007 What is this code for? $row['country'] = $country; The First thing is that you have transversed through all the records and so $row I think has to have false value rather than array i.e. $row has value of false The second thing I think you required $country=$row['country']; Please check this out if it helps Bye for now CSJakharia Quote Link to comment https://forums.phpfreaks.com/topic/55063-solved-mysql-based-menu-problem/#findComment-272213 Share on other sites More sharing options...
nita Posted June 11, 2007 Author Share Posted June 11, 2007 i did manage to get what i wanted. new code: $session=$_GET['session']; $result = mysql_query("SELECT country FROM session WHERE session='$session' LIMIT 1"); $row = mysql_fetch_array($result); echo " <span class='info1'>"; echo $row['country']; echo "<br><br></span>"; $result2 = mysql_query("SELECT * FROM session WHERE country='$row[country]' ORDER BY year DESC") or die(mysql_error()); while($rows = mysql_fetch_array( $result2 )) { echo "<span class='links1'> <A href='ontheroad.php?session=$rows[session]'>$rows[session]</a></span><br>"; } Thanks csplrj for advice ! Nita Quote Link to comment https://forums.phpfreaks.com/topic/55063-solved-mysql-based-menu-problem/#findComment-272251 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.