Jump to content

mysql_fetch_assoc(); help needed


marcus

Recommended Posts

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

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.