Mysql query does not work without errors

      $result53543534 = mysql_query("UPDATE users SET credit=credit+1 WHERE email= '{$battle_get['username']}'")
or die(mysql_error());

But not updated. check $battle_get['username']and the username is there. I am not getting any errors or anything else without adding ...

Any help would be very nice, thanks in advance

+5
source share
6 answers

See what the result is mysql_affected_rows():

if ( ! $result53543534 = mysql_query( "UPDATE users SET credit=credit+1 WHERE email= '{$battle_get['username']}'") ) {
    die( mysql_error() );
} else {
    echo "Number of rows affected: " . mysql_affected_rows() . "<br>";
}

I may not have the syntax completely right, but I hope you understand this idea. If the result is 0, you do not specify the syntax WHEREto actually refer to any string (s).

0, , , - . , , , , .

, echo sql, , .

+3

$email = $battle_get['username'];
UPDATE users SET credit=credit+1 WHERE email= '$email'
0

,

mysql_query("START TRANSACTION");
mysql_query("UPDATE users SET credit=credit+1 WHERE email= '{$battle_get['username']}'");
mysql_query("COMMIT");
0

, SQL-. SQL-, , . DESCRIBE mysql, , .

$sql = "UPDATE users SET credit=credit+1 WHERE email= '{$battle_get['username']}'"
echo $sql;
if ( ! $result53543534 = mysql_query($sql) ) {
    die( mysql_error() );
} else {
    echo "Number of rows affected: " . mysql_affected_rows() . "<br>";
}
0

UPDATE , . , SELECT INSERT, , UPDATE, UPDATE. mysql_error() , SQL , .

0

, , MySQL Workbench, SQL , ( , ), , WHERE:

UPDATE users SET credit = credit + 1 WHERE ('email'= '{$battle_get['username']}')
0

All Articles