How does one insert numbers with commas into an SQL database? I'm currently using PHP and MySQL.
If I include them in a standard INSERT, then SQL delimits the numbers by each comma. Example: 23,000,000 is THREE numbers to be inserted and then I get an error with the query (too many columns).
If I encode the variable containing the numbers with a single quote (see below) then it only inserts the group of numbers before the first comma. If info[1]= 23,000,000 then in MySQL it will be stored as 23.
$query = "insert into mytable values('$info[0]','$info[1]','$info[2])";
Yes, I could parse out the commas, put the numbers in the DB then display/output them with commas. But that seems like too much. There has to be somthing I'm missing. The table values are INT. I don't want to convert them to VARCHAR or CHAR because I would like the math functions provided by INT values.
Seriously, I am 😕 😕 😕 . Must've spent three solid hours debugging before realizing the REAL problem then searching solutions on the web. :eek: