I want to enter my XP in mysql. Now is the xp with a , so i removed them with a small script. Now i want to enter them in mysql and this is what i get : Overallxpnow = 8388607
Now the problem is my xp is 328,147,065. So it's is not right. I entered a echo with the variable that is used to get it in mysql and it shows the 328 xp amount (the correct one). The problem is that i really have no idea why it is showing me the wrong number.
This is the script :
$result = mysql_query("SELECT * FROM track WHERE `rsname` ='$name'"); if( mysql_num_rows($result) > 0) { mysql_query("UPDATE track SET `rsname` = '$name', `overallranknow` = '$Overalln', `overalllevelnow` = '$Overall[1]', `overallxp` = '$Overalln2' WHERE `rsname` = '$name', `overallranknow` = '$Overalln', `overalllevelnow` = '$Overall[1]' `overallxpnow` = '$Overall2'"); } else { mysql_query("INSERT INTO track (`rsname`, `overallranknow`, `overalllevelnow`, `overallxpnow` ) VALUES ('$name', '$Overalln', '$Overall[1]', '$Overall2')"); } } This is the code to remove the ,
$value2= $Overall[2]; $bad_symbols2 = array(",", "."); $Overall2 = str_replace($bad_symbols2, "", $value2); I hope i told as mutch info as i can.
Also i'm using mediumint as tabel type.
~Kev (bad english = sorry)
mysql_*functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.MEDIUMINT: minimum value: -8388608, maximum value: 8388607