Jump to content

[SOLVED] getting from one table listing from another


nathanmaxsonadil

Recommended Posts

  • 2 weeks later...

in phpmyadmin it works but in php it does not

here's my code

$sql = "SELECT `username` FROM `users` WHERE `username` IN (SELECT `need` FROM `tb`) ORDER BY `points` DESC";
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
echo "<ul>";
while ($row = mysql_fetch_assoc($result)) {
echo "<li>{$row['need']}</li>";
}
echo "</ul>";
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.