Jump to content

[SOLVED] PHP Subtraction Problem.


chmpdog

Recommended Posts

Hey,

 

Recently I was creating a script where it would pull off a number from the mysql server, then subtract one from it, then update the mysql number. But I keep getting a problem when I try: it returns '-1' each time the script runs

 

I have been trying to figure this out for about two hours now, Thanks for the help.

 

Here is the code:

$cur = mysql_fetch_array($resulm, MYSQL_ASSOC); // put the data in an array that we pull off the server

 $number = $cur[usernum];
$number = $number - 1;

    $q = "UPDATE "row" SET thenumber = '$number' WHERE id = '1'";
    mysql_query($q, $database->connection);

Link to comment
https://forums.phpfreaks.com/topic/133852-solved-php-subtraction-problem/
Share on other sites

Archived

This topic is now archived and is 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.