0

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

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by itisnot_me
0

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;
?>
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.