0

i get two or more duplicate row, i check if exist with :

    $Select = mysql_query("SELECT x3 FROM USER WHERE x1='$x2' AND x2='$x2'");
    $Count = mysql_num_rows($Select);

if($Count == 1){
die("Error");
}

i get x1 and x2 with $_POST['x1']....

I tried to do a test with the link and do not duplicate things (with $_GET[])

But when i execute this in mobile app i get duplicate or more row!! why? i think error is in php....

Noe Nazza
  • 61
  • 1
  • 10
  • 2
    If you're writing new code, **_please_ don't use the `mysql_*` functions**. They are old and broken, were deprecated in PHP 5.5 (which is so old it no longer even receives security updates), and completely removed in PHP 7. Use [`PDO`](https://secure.php.net/manual/en/book.pdo.php) or [`mysqli_*`](https://secure.php.net/manual/en/book.mysqli.php) with _prepared statements_ and _parameter binding_ instead. See http://stackoverflow.com/q/12859942/354577 for details. – ChrisGPT was on strike Dec 18 '16 at 00:37
  • Maybe you could make some debug tests ? Add a `die('Debug mode: $x1="' . $x1 . '" and $x2="' . $x2 . '");` and check the value returned. Analyze and correct if necessary. – Georges O. Dec 18 '16 at 00:39
  • You are missing a quote after the first `$x2` – RST Dec 18 '16 at 00:40
  • i can't print variabile but i get $_POST data with – Noe Nazza Dec 18 '16 at 00:43
  • $req_dump = print_r($_REQUEST, TRUE); $fp = fopen('debug.log', 'a'); fwrite($fp, $req_dump); fclose($fp); – Noe Nazza Dec 18 '16 at 00:43
  • because from app i sent a post request and the request are all right – Noe Nazza Dec 18 '16 at 00:44
  • I do not understand why the same link if I use $ _GET I duplicates while if I use the same link with $ _POST application after a few requests, It duplicates row – Noe Nazza Dec 18 '16 at 00:48

0 Answers0