<?php
session_start();
$db = mysql_connect("localhost","","") or die("Could not connect to database: ". mysql_error());
mysql_select_db("vartolova_site_vars") or die("Could not select database: ". mysql_error());
$sql = "SELECT * FROM user_settings WHERE user=\"$username\"";
$row = mysql_fetch_assoc(mysql_query($sql));
$sql = "UPDATE user_settings SET \n"
foreach($row as $key => $val)
$sql .= $key . '="' . $_POST[$key] . "\",\n";
$sql = trim($sql);
$sql = substr($sql,0,(strlen($sql)-1));
$sql .= "\nWHERE user=\"$username\"";
mysql_query($sql);
?>
ok, now i have this in the source. and now i uderstand the syntax but what i dont know is what the part of:
foreach($row as $key => $val)
$sql .= $key . '="' . $_POST[$key] . "\",\n";
and its givin this error:
Parse error: parse error, unexpected T_FOREACH in D:\Program Files\Apache Group\Apache2\htdocs\modify_settings.php on line 10