-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
  • 12,752
  • 5
  • 35
  • 59
AbdallahJg
  • 69
  • 6

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,285
  • 3
  • 17
  • 18
0
$sql = "DELETE from utilisateur where pseudo = '$pseudo'";
KiwiJuicer
  • 1,942
  • 14
  • 27