I am attempting to insert array values into a MySQL table. The array looks something like this:
[0] = 1/15 (month and date)
[1] = 22:23:34 (time)
[2] = YHR (arbitrary info)
[3] = PHS (arbitrary)
[4] = #213 (record number)
[5] = JOHNSON (name of person)
[6] = 342.5 (value a)
[7] = 455.2 (value b)
When I try to do this, I receive no errors...but only the first key goes into the database--and when it gets there, it appears as the first number divided by the second number, i.e. 1/15 will show up as 0.07.
I've set up my SQL table with all fields as TEXT, since that's all they really need to be. My script gets the total number of records (entered via a textfield), does some formatting on them, and does a FOR loop based on the number of records. On each iteration, it does this:
$query = "INSERT INTO $table (date) VALUES ($newvals_array[0])";
$doit = mysql_query($query);
where $table is the table name and $newvals_array is the array.
Does anybody have any idea why none of the array values except for [0] are being inserted? Or how I can stop it from attempting to do arithmetic on each entry? I can't seem to find any info in the PHP or MySQL documentation on this, and I'm not a very experienced programmer.
Thanks for any help,
Josh Ellis