0

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)

7

1 Answer 1

2

You are using the wrong field type. The documentation says MEDIUMINT has a range of -8388608 to 8388607.

Sign up to request clarification or add additional context in comments.

1 Comment

+1 This is what happens when you go cheap on datatypes :) Know thy datatypes and their sizes, only then can you make informed DB design decisions.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.