MySQL Forums
Forum List  »  PHP

SELECT multiple columns
Posted by: Adam 552
Date: October 03, 2007 11:07AM

$result = mysql_query("SELECT army FROM users WHERE username = '$username'");
if (!$result) {
    echo 'Could not run query: ' . mysql_error();
$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();
$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.

Options: ReplyQuote

Written By
SELECT multiple columns
October 03, 2007 11:07AM
October 03, 2007 03:52PM

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.