mysql - php Loop and insert into -
i'm using php form mysql. have loop , put data in database depends on column. example data1 -> insert column1, data2 -> column2
in loop i= 1 5 try this
mysql_query("insert day(numb, g['$i']) values('$num', '$tout' ) ") or die(mysql_error());
but doesn't work. have other solution?
thanks
as others have suggested use mysqli, i. query like:
mysqli_query($con,"insert day (numb, $g[$i]) values('".$num."', '".$tout."' )") or die(mysql_error());
just remind $con
variable used connect db
mysqli_connect(host,username,password,dbname);
Comments
Post a Comment