Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP更新数据库_Php_Mysql - Fatal编程技术网

PHP更新数据库

PHP更新数据库,php,mysql,Php,Mysql,只是停留在这个mysql更新代码上。我修改了函数插入代码,试图让它更新我的字段 任何人都知道我的代码有什么问题,或者我的错误可能在其他地方 提前谢谢 { $_POST['dogs'] = mysql_real_escape_string($_POST['dogs']); $_POST['cats'] = mysql_real_escape_string($_POST['cats']); mysql_query("

只是停留在这个mysql更新代码上。我修改了函数插入代码,试图让它更新我的字段

任何人都知道我的代码有什么问题,或者我的错误可能在其他地方

提前谢谢

{


            $_POST['dogs'] = mysql_real_escape_string($_POST['dogs']);
            $_POST['cats'] = mysql_real_escape_string($_POST['cats']);


            mysql_query("   UPDATE animals WHERE id='5' SET (dogs,cats)
                            VALUES(

                                '".$_POST['dogs']."',
                                '".$_POST['cats']."',
                            ) ");

        }

像这样修复代码

$dogs = mysql_real_escape_string($_POST['dogs']);
$cats = mysql_real_escape_string($_POST['cats']);
mysql_query("UPDATE animals 
             SET dogs = '$dogs', cats = '$cats' 
             WHERE id='5'");

之前设置…
在哪里…
谢谢@kefy的工作很有魅力。我不知道该去哪里。