marcus Posted November 5, 2006 Share Posted November 5, 2006 Ok, I get the normal [code]Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/zack/public_html/rpg/inc/addxp.php on line 6[/code]Code:[code]<?php$connection = mysql_connect(localhost,zack_rpg,passwordhere);$db = mysql_select_db(zack_rpg,$connection);$sql = "SELECT * stats WHERE stats.id=$_COOKIE[id]";$res = mysql_query($sql);$res2 = mysql_fetch_assoc($res);$xp = $res2[xp];$rand = rand(0,10);$xpadd = "$xp + $rand";$sql2 = "UPDATE stats SET xp = `$xpadd` WHERE stats.id=$_COOKIE[id]";$res3 = mysql_query($sql2);?>[/code] Link to comment Share on other sites More sharing options...
ToonMariner Posted November 5, 2006 Share Posted November 5, 2006 $sql = "SELECT * stats WHERE stats.id=$_COOKIE[id]";change to$sql = "SELECT * stats WHERE id = " . $_COOKIE[id]; Link to comment Share on other sites More sharing options...
marcus Posted November 5, 2006 Author Share Posted November 5, 2006 Didn't do anything but keep the error the same. Link to comment Share on other sites More sharing options...
marcus Posted November 5, 2006 Author Share Posted November 5, 2006 nevermind, got it working -locks- Link to comment Share on other sites More sharing options...
Recommended Posts