MySQL Forums :: PHP :: SELECT multiple columns

Advanced Search

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

Subject Written By Posted
SELECT multiple columns Adam 552 10/03/2007 11:07AM
Re: SELECT multiple columns Peter Brawley 10/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.