K
K
kiril90112018-02-25 10:15:25
PHP
kiril9011, 2018-02-25 10:15:25

Why doesn't Update work?

<?

session_start();

require 'connect.php';

  if(isset($_POST['name'])){
     $name=$_POST['name'];
     $email=$_POST['email'];
     $tel=$_POST['tel'];
     $date5=$_POST['date5'];
 $id=$_POST['id'];


$insert_sql2 = ("UPDATE `visits` SET `name`= '{$name}' WHERE `login` = '{$_SESSION['login']}' AND id = '$login'") or die(mysql_error());

 
mysql_query($insert_sql2);
 }
 
   if ($insert_sql2){echo "<center><table width=50% bgcolor=#00aff0><tr><td><center><font color=#ffffff>Информация сохранилась</font></center></td></tr></table></center><br><br>";}
 
 

$login = $_REQUEST['user2'];
 $result=mysql_query("SELECT * FROM `visits` WHERE login = '{$_SESSION['login']}' AND id = '$login'") or die(mysql_error());
  while($row=mysql_fetch_array($result))
echo '<form action="" method=post enctype="multipart/form-data" ><table width=90%>

<tr>
<td>имя</td>
<td><input type=text name=name value="' . $row['name'] . '"></td>
</tr>
<tr>
<td>email</td>
<td><input type=text name=key2 value="' . $row['email'] . '"></td>
</tr>

</table><br><br>
        <input type=submit value=Сохранить class=button10><br>
    </form><br><br>';
    ?>

I have insert orders in the admin panel and there I put the edit button (picture of pencils) you press and you can clearly see select the output itself everything is displayed correctly, but if I change the info update is not, why?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2018-03-02
Alexsev @MaxGoody

Ummm...
Maybe because you don't send a request?
And MySQL is already deprecated and removed in PHP 7.0.0+

J
Jedi, 2018-05-03
@PHPjedi

MVC to the rescue! Why do you write process php script?
Fat Free Framework (F3) .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question