开发者

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 -

$names = mysqli_real_escape_string($connect, trim($_GET['name']));
echo $names;
ini_set('display_errors','On');
error_reporting(E_ALL);
if(isset($_POST['submitt开发者_JS百科ed'])){


Try to echo $s. This will output the query with the variabele values so you can check if there are any errors with these.


Plus use this this functions
mysql_real_escape_string
mysqli::real_escape_string

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜