I need script to delete mysql data with php

Asked

Viewed 309 times

1

people need a php script where I log in and grab 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, POSICAOX: 15, POSICAOY: 19.

This with ajax technology updating position every 5 minutes with js settimeout.

if you know of a simple postem ai script or example.

  • Don’t take this the wrong way, but this isn’t really a question, it’s more like asking them to do the job for you. However if you have any specific questions about Ajax or PHP I will be here to help you willingly.

  • not friend and ask for an example, because everything I know about mysql on google and study has nothing on how to erase data from a table and rewrite , so said if you know post an example

1 answer

1


Long 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 to keep you up to date with x users in x time, I’m not the best person to help you, but I’m sure a more experienced person will give you some tips on how to do this.

  • Thank you very much Elder helped and very positive you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.