I am trying to make a string that will contain variables.

The resulting string will be a sql query string and must look something
like

" update $table_name set  key='$key' , next='$next' where id = $id"

Since the variable name is the same as the key name, I tried to generate
this string with a foreach statement looking something like this:

foreach( $myrow as $key=>$val) {
$sql .= "$key = ' \$$key ' ,";
}

This then makes the string look as follow:

key='$key',next='$next', and I just add the rest of the string to the
front and back, yet, when I now try to use this string in the
mysql_query() function, it does not recognise the '$key' and '$next' as
variables and add them into the db as $key and $next. I need to know how
I am going to make this string "recognise" the variables in them.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to