stewart715 Posted October 19, 2006 Share Posted October 19, 2006 okay say i have this datauid bid rid2 5 05 7 17 8 1 8 7 07 2 04 3 17 4 1I need a script that will print ALL the bid's where the uid is 7 and the rid is 1...how would i do that?the result from the above table should be 4 and 8, for example. Quote Link to comment https://forums.phpfreaks.com/topic/24499-listing-data-from-a-table-based-on-selected-value/ Share on other sites More sharing options...
tleisher Posted October 19, 2006 Share Posted October 19, 2006 mysql_query("SELECT `bid` FROM `table` WHERE `uid` = '7' AND `rid` = '1'") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/24499-listing-data-from-a-table-based-on-selected-value/#findComment-111610 Share on other sites More sharing options...
stewart715 Posted October 20, 2006 Author Share Posted October 20, 2006 hmm i'm getting Resource ID #3There is a uid with 7 and a received of 1 in the same row in the actual table..but idk why it isn't working[code]<?php$link = mysql_connect("localhost","thepdcom_popnew","PASSWORD");mysql_select_db("thepdcom_popnew",$link);$query = mysql_query("SELECT buddy FROM buddylist WHERE uid = '7' and received = '1'") or die(mysql_error());mysql_query($query);$result = mysql_num_rows($query); print $query;?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/24499-listing-data-from-a-table-based-on-selected-value/#findComment-111620 Share on other sites More sharing options...
.josh Posted October 20, 2006 Share Posted October 20, 2006 [code]<?php$link = mysql_connect("localhost","thepdcom_popnew","PASSWORD");mysql_select_db("thepdcom_popnew",$link);$query = mysql_query("SELECT buddy FROM buddylist WHERE uid = '7' and received = '1'") or die(mysql_error());mysql_query($query);$result = mysql_num_rows($query); if ($result > 0) { while ($list = mysql_fetch_array($query)) { echo "{$list['buddy']} <br>"; }}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/24499-listing-data-from-a-table-based-on-selected-value/#findComment-111631 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.