Page 1 of 1

Problem with inserting variable data into database

Posted: Tue Oct 25, 2011 10:09 am
by shantothegreat
I separate some data from a page with preg_match_all function. and store the data into $out variable. when I print the data it is ok but when i try to insert the data in the mysql database using

Code: Select all

mysql_query("INSERT INTO livedata (name, ltp, chng) VALUES ('$out[0][1]','$out[0][2]','$out[0][3]')")
it creates following data in the database

Code: Select all

Array[1] 0 0
That is not correct. The name is text type and ltp and chng is float type. Can anyone plz tell me where is the problem?

Re: Problem with inserting variable data into database

Posted: Tue Oct 25, 2011 10:17 am
by Celauran

Code: Select all

mysql_query("INSERT INTO livedata (name, ltp, chng) VALUES ('{$out[0][1]}',{$out[0][2]},{$out[0][3]})");