need script to delete mysql data with php [closed]

1

People need a php script where I log in and get the user id and where you can change user properties for example:

I have a table in mysql with: USER: TEST, POSICAOX: 10, POSICAOY: 10.

The script takes id and checks and then changes the data to USER: TEST, POSITIONX: 15, POSITION: 19.

and this with ajax technology that updates the position every 5 minutes with the js settimeout.

If you know of a script or a simple example then post it.

    
asked by anonymous 22.04.2015 / 00:23

1 answer

0

Live!

The PHP script to update user positions can do something like this:

// Configuração da Base de Dados
// Nota: Tens de alterar estes valores de acordo com a tua Base de Dados.
$DB_HOST = "localhost";
$DB_NAME = "Test";
$DB_USER = "root";
$DB_PASS = "Senha";

// Criar a Connection
$conn = new PDO("mysql:host=$DB_HOST;dbname=$DB_NAME", $DB_USER, $DB_PASS);

// Update dos dados do Usuário
$pX= 15;
$pY= 15;
$idUsuario = 1;

$sql = "UPDATE NomeDaTuaTabela
        SET POSICAOX=?, POSICAOY=?
        WHERE idUsuario=?";

$q = $conn->prepare($sql);
$q->execute(array($pX, $pY, $idUsuario));

Regarding the Ajax function for updating user data from x in x time, I am not the best person to help you, but I am sure that someone more experienced than I will give you some tips on how to do this .

    
22.04.2015 / 01:02