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
精彩评论