R1der Posted June 29, 2006 Share Posted June 29, 2006 ok basicly i want to echo all the names of people with a certon rank.i.e[code]<?if($user[uRank]=='5' or $user[uRank]=='4' or $user[uRank]=='3' ){?>[/code]then it will echo all usernames with the user rank 5 , 4 and 3.Does this make sence? lol Quote Link to comment https://forums.phpfreaks.com/topic/13183-how-can-i-echo-from-the-database/ Share on other sites More sharing options...
.josh Posted June 29, 2006 Share Posted June 29, 2006 well uh... well, assuming that your variables are holding the correct information, that would [i]technically[/i] work as is... Quote Link to comment https://forums.phpfreaks.com/topic/13183-how-can-i-echo-from-the-database/#findComment-50732 Share on other sites More sharing options...
R1der Posted June 29, 2006 Author Share Posted June 29, 2006 [!--quoteo(post=389162:date=Jun 29 2006, 03:27 AM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ Jun 29 2006, 03:27 AM) [snapback]389162[/snapback][/div][div class=\'quotemain\'][!--quotec--]well uh... well, assuming that your variables are holding the correct information, that would [i]technically[/i] work as is...[/quote]yes all that info is correct. but what i ment was how would i echo the usernames? i have tried a few ways but get errors. but i am still rather new to php Quote Link to comment https://forums.phpfreaks.com/topic/13183-how-can-i-echo-from-the-database/#findComment-50735 Share on other sites More sharing options...
hackerkts Posted June 29, 2006 Share Posted June 29, 2006 Are you echoing the data from database or ..?Btw.. What's the error showing ? Quote Link to comment https://forums.phpfreaks.com/topic/13183-how-can-i-echo-from-the-database/#findComment-50736 Share on other sites More sharing options...
ToonMariner Posted June 29, 2006 Share Posted June 29, 2006 OK this is how i would do it....[code]<?php// create a comma separated string of ranks to display.$ranks = "3,4,5";$qry = "SELECT * from `users` WHERE `uRank` IN (" . $ranks . ") ORDER BY `username` ASC";$qry = mysql_query($qry);?><ul><?phpwhile ($row = mysql_fetch_assoc($qry) ){?><li><?php echo $row['username']; ?></li><?php}?></ul><?php[/code]Now you can put all the html to control the look around the echo statement..I have used a list but if you are displying other information associated with that user then a table would be appropriate. Quote Link to comment https://forums.phpfreaks.com/topic/13183-how-can-i-echo-from-the-database/#findComment-50738 Share on other sites More sharing options...
R1der Posted June 29, 2006 Author Share Posted June 29, 2006 Thanks everyone for your replys to help.thanks ToonMariner that worked great Quote Link to comment https://forums.phpfreaks.com/topic/13183-how-can-i-echo-from-the-database/#findComment-50740 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.