使用PHP和MySQL更新信息

时间:2018-04-25 07:22:17

标签: php mysql database updating

请告诉我我做错了什么。我认为可能存在$_POST错误,但我是PHP的新手,只需要一只手。

<?php

include("config.php");
if(isset($_POST['submit']))
{

$medical=$_POST['medicalin'];

    if($medical=='')
    {
        echo"<script>alert('Please enter some Medical Information, if there is none to report, simply type N/A.')</script>";
       exit();
    }

//updating
$query = "UPDATE test SET medical= '$medical' WHERE id=".$user['id'];

if(mysql_query($query)) {
    echo"<script>window.open('/success','_self')</script>"; }

else {
   echo "There was an error updating your medical information, please contact us immediately.";}

}

?>

0 个答案:

没有答案