i know i should know this but for the life of me i forgot it.

what i want to do is within my loop. I want a single variable that has multiple info in it that can be separated by a ,

ex:


loop one {
$store = "fieldone='$fieldone'";
}
loop two {
$store = "fieldtwo='$fieldtwo'";
}
loop three {
$store = "fieldthree='$fieldthree'";
}

echo $store;

//result: fieldone='$fieldone', fieldtwo='$fieldtwo', fieldthree='$fieldthree'

thanks in advance

I don't know what you are trying to do with the loop but I think this is what you are looking for:

<?php
$store = array();

$store["fieldone"] = $fieldone;
$store["fieldtwo"] = $fieldtwo;
$store["fieldthree"] = $fieldthree;
?>

im trying to streamline the query process. this is what im doing

$fields = array("companyname","password");
$table = "users";
		
		foreach ($fields as &$value) {
			${$value} = $_POST[$value];
                        $queryvalues = "$value='${$value}', "
			}
		
$query = "UPDATE $table SET $queryvalues WHERE id='$id' ";

$result = mysql_query($query);

where i need queryvalues as the one that stores the multiple values needed to be put in the query

anyone?

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.