-1

i'm using a php script in my Android project to delete a lign from the database . here is the php file content :

<?php
$pseudo = $_POST['pseudo']; 
define('HOST','localhost');
define('USER','root');
define('PASS','');
define('DB','ract');

$con = mysqli_connect(HOST,USER,PASS,DB);

$sql = "DELETE from utilisateur where pseudo=$pseudo";
$res = mysqli_query($con,$sql);
?>

I think that the main problem in comparing pseudo to $pseudo

Thamilhan
  • 13,040
  • 5
  • 37
  • 59
AbdallahJg
  • 69
  • 7

2 Answers2

1

For god sake, protect your query against SQL injection :

$sql = "DELETE from utilisateur where pseudo = '".mysqli_real_escape_string($con, $pseudo)."'";
noli
  • 3,535
  • 3
  • 18
  • 20
0
$sql = "DELETE from utilisateur where pseudo = '$pseudo'";
KiwiJuicer
  • 1,952
  • 14
  • 28