I Have Try To Modify My Script Now The Script Have No Error´s but wen i call by ajax in to the file http://villageop/saveid.php?user_id=100 its look like the script have work well but it do nothing on database it have not modify The Database
<?php
header('Access-Control-Allow-Origin: *');
error_reporting(E_ALL);
ini_set('display_errors',1);
$servername = "localhost";
$username = "publiadd_publix";
$password = "1a3g7893fsh";
try {
$conn = new PDO("mysql:host=$servername;dbname=publiadd_registervillageop", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
}
catch(PDOException $e)
{
echo "Connection failed: " . $e->getMessage();
}
if(isset($_GET['user_id'])){
//$user_id = intval($_GET['user_id']);
//Lightly sanitize the GET's to prevent SQL injections and possible XSS attacks
$sql = "INSERT `publiadd_registervillageop`
//(`user_id`)
//VALUES ('publiadd_registervillageop');
//";
//$sql = mysql_query("INSERT INTO `publiadd_registervillageop`.`users` (`user_id`) VALUES ('user_id');");
//$sql = mysql_query("UPDATE `users` SET user_id = SET user_id +'$user_id' WHERE user_id = " . $_SESSION['user']);
if($sql){
//The query returned true - now do whatever you like here.
echo 'Your ID was saved. Congrats!';
}else{
//The query returned false - you might want to put some sort of error reporting here. Even logging the error to a text file is fine.
echo 'There was a problem saving your points. Please try again later.';
}
}else{
echo 'Your id wasnt passed in the request.';
}
// close MySQL connection
$conn = null;
?>
<html>
<head>
</head>
<body>
<body bgcolor="#ffffff">
</body>
</html>