Here is the code: if (isset ($ _ POST ['city'])) {$ city = ($ _POST ['city']); $ city = $ city;

$query = "SELECT * FROM profiles WHERE user='$user'"; if (mysql_num_rows(queryMysql($query))) { queryMysql("UPDATE profiles SET user='$user' where city='$city'"); } else { $query = "INSERT INTO profiles VALUES('$user', '$name', '$surname', '$city', '$age', '$site', '$icq', '$skype', '$vk', '$twit', '$about')"; queryMysql($query); } 

} else {$ query = "SELECT * FROM profiles WHERE user = '$ user'"; $ result = queryMysql ($ query);

 if (mysql_num_rows($result)) { $row = mysql_fetch_row($result); $city = $row[3]; } else $city = ""; 

}

$ city = $ city;

Here is the form code;

 < form method='post' action='profile.php' enctype='multipart/form-data'> Имя: < input type='text' maxlength='64' name='name' value='$name' /><br /> Фамилия: < input type='text' maxlength='64' name='surname' value='$surname' /><br /> Город: < input type='text' maxlength='64' name='city' value='$city' /><br /> Сайт: < input type='text' maxlength='64' name='site' value='$site' /><br /> ICQ: < input type='text' maxlength='64' name='icq' value='$icq' /><br /> Skype: < input type='text' maxlength='64' name='skype' value='$skype' /><br /> ВКонтакте: < input type='text' maxlength='64' name='vl' value='$vk' /><br /> Twitter: < input type='text' maxlength='64' name='twit' value='$twit' /><br /> Аватарка: < input type='file' name='image' size='14' maxlength='32' /><br /> < input type='submit' value='Сохранить' /> < /form> 

PS Other information is entered normally, except this

    2 answers 2

    Learn operator syntax

     INSERT INTO profiles (`USER_COL`, `NAME_COL`) VALUES('$user', '$name') 
       queryMysql ??? 

      learn the syntax. mysql_query (QUERY);

       if (isset($_POST['city'])) { $city = ($_POST['city']); $city = $city; 

      why $ city = $ city;

        queryMysql("UPDATE profiles SET user='$user' where city='".$city."'");