hey, I got that query to work but i dont know how to display it on an HTML page, I'm using this and its not displaying anything:
$captainquery = mysql_query("select if(captain = 1,'C','') from stats AS cstatus WHERE captain > 0 and number = '19' group by number"); while($captain2=mysql_fetch_array($captainquery)){ printf ("C indicates captain: %s",$captain2["cstatus"]); } and I'm certain the number '19' is set to be a captain. Thanks! -------------------------------------------- -Alex "Big Al" Behrens E-mail: [EMAIL PROTECTED] Urgent E-mail: [EMAIL PROTECTED] (Please be brief!) Phone: 651-482-8779 Cell: 651-329-4187 Fax: 651-482-1391 ICQ: 3969599 Owner of the 3D-Unlimited Network: http://www.3d-unlimited.com Send News: [EMAIL PROTECTED] ----- Original Message ----- From: "Jeff Kilbride" <[EMAIL PROTECTED]> To: "Alex Behrens" <[EMAIL PROTECTED]>; "MYSQL" <[EMAIL PROTECTED]> Sent: Sunday, November 24, 2002 5:08 PM Subject: Re: displaying a letter based on a query value > select if(captain = 1, 'C', '') > from stats > where captain > 0 > and number = $number > group by number > > This returns 'C' whenever the captain field is 1 and '' (empty string) > otherwise. > > --jeff > > ----- Original Message ----- > From: "Alex Behrens" <[EMAIL PROTECTED]> > To: "DL Neil" <[EMAIL PROTECTED]>; "MYSQL" > <[EMAIL PROTECTED]> > Sent: Sunday, November 24, 2002 3:53 PM > Subject: Re: displaying a letter based on a query value > > > > Hey, > > > > I'm not sure how to implement this into my query, i looked it on the > > mysql.com documentation and it's confusing. > > > > I tried this query: > > > > select captain from stats where captain > 0 if (captain(1,'C') and number > > = '$number' group by number; > > > > but i dont think its right cuz its returning a value. How do I make it > show > > if the captain value is 1 that it returns a "C"? > > > > Thanks! > > -------------------------------------------- > > -Alex "Big Al" Behrens > > E-mail: [EMAIL PROTECTED] > > Urgent E-mail: [EMAIL PROTECTED] (Please be brief!) > > Phone: 651-482-8779 > > Cell: 651-329-4187 > > Fax: 651-482-1391 > > ICQ: 3969599 > > Owner of the 3D-Unlimited Network: > > http://www.3d-unlimited.com > > Send News: > > [EMAIL PROTECTED] > > ----- Original Message ----- > > From: "DL Neil" <[EMAIL PROTECTED]> > > To: "Alex Behrens" <[EMAIL PROTECTED]>; "MYSQL" > <[EMAIL PROTECTED]> > > Sent: Sunday, November 24, 2002 4:38 PM > > Subject: Re: displaying a letter based on a query value > > > > > > > Hey Alex > > > > > > > select captain from stats where captain > 0 and number = '23' group by > > > > number; > > > > > > > > this returns a 1 for any player with the number that matches being a > > > > captain, however it display a 1 is it possible to make that 1 > displayed > > as > > > a > > > > C on my page? > > > > > > > > > MySQL allows an IF() within the SELECT clause. > > > =dn > > > > > > > > > > > > > > --------------------------------------------------------------------- > > Before posting, please check: > > http://www.mysql.com/manual.php (the manual) > > http://lists.mysql.com/ (the list archive) > > > > To request this thread, e-mail <[EMAIL PROTECTED]> > > To unsubscribe, e-mail > <[EMAIL PROTECTED]> > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php