grr...getting tired of trying to get this thing to work...kk heres my code
<?php
mysql_connect("localhost", "punkgo_punkgo", "*******")
or die(mysql_error());
mysql_select_db("punkgo_users")
or die("Couldnt Select Db!");
$sql = "SELECT (users.points - items.value) AS difference
FROM users, items
WHERE users.userid = $user_id";
$query = mysql_query($sql);
$points_left = mysql_result($query, 0, 0);
if ($points_left < 0) {
echo "User with ID $user_id doesn't have enoguh points to buy this item!\<br />\n";
} else {
$sql = "UPDATE users SET points = $points_left";
if (mysql_query($sql)) {
echo "Player with ID $user_id has now $points_left points left.<br />\n";
}
}
?>
and heres my error
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/punkgo/public_html/purchase.php on line 13
any suggestions?