简体   繁体   English

在Update子句中使用AND - Mysql

[英]Using AND in Update clause - Mysql

My Code 我的守则

$names = $_GET['name'];
    $s = "update users set filelocation='$newname' where sessionusername = '$u' AND name = '$names'";

the above does not work, while the below works. 以上不起作用,而以下工作。

$s = "update users set filelocation='$newname' where sessionusername = '$u'";

How do i get it to work? 我如何让它工作? every variable has a value that matches the database. 每个变量都有一个与数据库匹配的值。

Thanks. 谢谢。

This is where I declare $names - 这是我声明$ name的地方 -

$names = mysqli_real_escape_string($connect, trim($_GET['name']));
echo $names;
ini_set('display_errors','On');
error_reporting(E_ALL);
if(isset($_POST['submitted'])){

Try to echo $s. 试着回应$ s。 This will output the query with the variabele values so you can check if there are any errors with these. 这将输出具有varbele值的查询,以便您可以检查这些是否有任何错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM