Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - How would I do..... | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
DarkSlaya POOOOOOOOOOOORN! Level: 88 Posts: 3083/4249 EXP: 6409254 For next: 241410 Since: 05-16-04 From: Montreal, Quebec, Canada Since last post: 8 hours Last activity: 5 hours |
| ||
Normally, I figure what I need by myself, by this time I really don't have a clue of what to do. The thing I'd like to do would be to grab data from an mySQL database, and then do a loop to print the rows. That part's easy, I do this all the time. However, I'd like to print data even when nothing is returned (not what while() does). My guess would be to use for() but I'm not sure. I'm not even sure if this made sense.... Edit: Forgot to mention, I make this in PHP. (edited by DarkSlaya on 12-28-04 02:45 PM) |
|||
windwaker Ball and Chain Trooper WHY ALL THE MAYONNAISE HATE Level: 61 Posts: 820/1797 EXP: 1860597 For next: 15999 Since: 03-15-04 Since last post: 4 days Last activity: 6 days |
| ||
So... you just want to echo some text? Here's some crappy AB code that'll do what you want: $sql = mysql_query("SELECT * FROM `table` ORDER BY `id` LIMIT 50"); for($i = 0;$var[$i] = mysql_fetch_array($sql, MYSQL_ASSOC);$i < 50;$i++); while($whatever = $var){ echo $whatever['$fieldname']; $whatever = next($var); } I can't remember where I found that code, I think it was in the Acmlmboard a few places. This'll print the first 50 rows of the table "table". I'm not exactly sure what you meant though, as this is easy and you probably already know this. |
|||
DarkSlaya POOOOOOOOOOOORN! Level: 88 Posts: 3084/4249 EXP: 6409254 For next: 241410 Since: 05-16-04 From: Montreal, Quebec, Canada Since last post: 8 hours Last activity: 5 hours |
| ||
I guess I suck at explaining things ... I'll take an example of what I want, it'll be easier: Let's say you have a browser based game, in it you have guilds or whatever you call them. In them you have players, right? So normally, you make a loop to get them. However, you wanna add something to it. You want the guilds to have Higher Ranked players (we'll call them super members). However, a guild will not necessary have one, and my have more than one. Now, my problem (if I use the example), would be that I want to display the players in a guild even when there are no Super Members. But the way I do it uses two while() loop, which won't display a certain row if it the condition isn't matched. The first while() will always return TRUE while the second one will return FALSE sometimes. |
|||
Vystrix Nexoth Level: 30 Posts: 207/348 EXP: 158678 For next: 7191 Since: 03-15-04 From: somewhere between anima and animus Since last post: 3 days Last activity: 2 days |
| ||
$resultset = mysql_query ("SELECT whatever FROM wherever etc"); as an aside, next time, use a more informative thread title. I almost skipped this one. "ZOMG HEPL!11" is not informative. "MySQL design problem" (e.g.) would be. |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - How would I do..... | | | |