PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$item = mysql_query("SELECT `id`, `name`, `rarity1`, `rarity2` FROM `items` WHERE `level`='".$mon['level']."'");
$irand = rand(1,1000);
while(($item = mysql_fetch_assoc($item)) && (!$inews)) {
This gives me a
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/stlawren/www/cbc/KoD/game/explore.php on line 129
error. I can't find anything wrong with the query - and when I comment out the while loop and add a mysql_fetch_assoc($item) above it, I don't get any problem.
try tacking on an 'or die(mysql_error());' line on the end of your query line. That'll output any mysql error that happen. Also, echo the query before its executed and run what's output. You might get something you're not expecting.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
In your initial code posting, you name your resultset 'item', then overwrite that variable each time you loop. ~djot renamed your resultset 'result'. Did you make the change that ~djot suggested? Could you post your updated code?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.