runnerjp Posted June 3, 2008 Share Posted June 3, 2008 ok im creating a pm system and its all working but i would like a user to be able to select from there friends list.... i was thinking about making a drop down table holding the query from there friends so all there friends will be within the query.... is this possible or is there a better option Link to comment https://forums.phpfreaks.com/topic/108513-solved-question-can-you-have-a-drop-down-table-holding-values-of-a-query/ Share on other sites More sharing options...
DarkWater Posted June 3, 2008 Share Posted June 3, 2008 Is it possible to do a query? Is it possible to make a dropdown menu? Obviously yes, so obviously you can join the two. O_O Link to comment https://forums.phpfreaks.com/topic/108513-solved-question-can-you-have-a-drop-down-table-holding-values-of-a-query/#findComment-556375 Share on other sites More sharing options...
runnerjp Posted June 3, 2008 Author Share Posted June 3, 2008 ok i tried doing this (i think its the right path to go lol) but the table does not display anything lol <?php session_start(); require_once '../settings.php'; checkLogin ('1 2'); $username= get_username($_SESSION['user_id']); $query = "SELECT * FROM `friends` WHERE `username`= '$username' ORDER BY username ASC;"; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)){ $friends= $row['friendname'];} $friends; $lines = $friends;; echo '<select class="inputedit" id="friends" name="friends">'; foreach($lines as $line) { echo '<option>'.$line.'</option>'; } echo '</select>';?> Link to comment https://forums.phpfreaks.com/topic/108513-solved-question-can-you-have-a-drop-down-table-holding-values-of-a-query/#findComment-556389 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.