ok i have got values from a for loop, and will like to insert them into a database.

$brush_price = 5; 

for ( $counter = 10; $counter <= 100; $counter += 10) {

	$values = $brush_price * $counter;
	
}
$query = mysql_query("insert into brushprice(brushprice) values($values)")
or die(mysql_error());

But i only get a random number inserted into the database, question is how do i now insert everyvalue such that when i want to show it(select statement) i can easily put the values as an array.

Member Avatar for rajarajan2017

Write the query within the for loop

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.