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

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -