Ivan Golubar
asked on
I can not update a specific column in DB
I am using input type color as i want to save selected color to DB.
I can see color which I did choose in console (check js), but something gets wrong with ajax as I can not get echo "nnnnnnnn", but just "mmmmmmmmmmm" (check php).
So I might not debug forward in case of other errors.
php
Can you see from data that I provided what is the problem?
Just for Info: I am doing the initial setting of color as next.
I can see color which I did choose in console (check js), but something gets wrong with ajax as I can not get echo "nnnnnnnn", but just "mmmmmmmmmmm" (check php).
So I might not debug forward in case of other errors.
php
<?php
echo "mmmmmmmmm";
if(isset($_POST["uColorIsSet"])){
echo "nnnnnnnnnnnn";
include_once("/wp-content/themes/n4/php_includes/db_conx.php");
$uColor2 = mysqli_real_escape_string($db_conx,$_POST['uColor2']);
$sql = "UPDATE users SET yourColor='$uColor2' WHERE username='$u'";
$query = mysqli_query($db_conx, $sql);
}
?>
and jsfunction updateAll2(event) {
var uColorIsSet=0;
var uColor2 = event.target.value;
console.log("selected color"+uColor2);
$.ajax({
method:"POST",
url: '/wp-content/themes/n4/nF4/user.php',
data: {
"uColorIsSet":1,
"uColor2":uColor2
},
datatype: "text",
success: function(strdate){
console.log("aaaaaaaaaaaaaa");
},
error: function(error, txtStatus) {
console.log(txtStatus+" error on load of canvas on user page");
console.log('error');
}
});
}
Can you see from data that I provided what is the problem?
Just for Info: I am doing the initial setting of color as next.
$sql = "INSERT INTO users (yourColor) VALUES ('$c')";
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry for bad question. I will ask differently.
How is it possible that I am getting answer in console to confirm me that ajax was executed successfully, but then there were no changes in DB?
How is it possible that I am getting answer in console to confirm me that ajax was executed successfully, but then there were no changes in DB?
ASKER
I am using now :
instead of
and is working.
$db_conx=mysqli_connect("localhost","xxxxxxxx","yyyyyyyy","zzzzzzzz")or die ("no connection");
instead of
include_once("/wp-content/themes/n4/php_includes/db_conx.php");
and is working.
ASKER
Open in new window
How is possible to get answer in console and no changes in DB?