SELECT multiple columns
Posted by:
Adam 552
Date: October 03, 2007 11:07AM
<?php
$result = mysql_query("SELECT army FROM users WHERE username = '$username'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$row = mysql_fetch_row($result);
$cheese = mysql_query("SELECT username, xcounits, ycounits, points FROM users WHERE army = '$row[0]' LIMIT 0 , 1000");
if (!$cheese) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$toast = mysql_fetch_row($cheese);
echo '<B>';
echo $toast[0];
echo '</b>';
?>
OK, I have got a problem... for some reason when I use the script above it only displays the persons username. Why not the xcounits,ycounits and points? Also this will show anyone whos in the same 'army' as this user.
Subject
Written By
Posted
SELECT multiple columns
October 03, 2007 11:07AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.