I'm very noob in php and SQL and I want to solve this weird problem I'm facing :S
Here I show you the code:
<?php
require 'dbdata.php';
$gp = $_POST["GP"];
$DBH1 = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
$RQ1 = $DBH1->prepare("SELECT GgID,ID FROM Usuarios WHERE GgID='$gp'");
$RQ1 -> execute();
$row1 = $RQ1->fetch(PDO::FETCH_BOTH);
if(($RQ1 -> rowCount()) >0){
echo $row1[1] . "////@@";
echo "Login";// Username is taken
$DBH = null;
}
else{
echo "0" . "////@@";
echo "Register";
$DBH = null;
}
?>
Now I want to explain you what should it do and what randomly do. The script is a simple one, I make a post with a string, that string has to be on the database and the script return me the content of the ID column, BUT, a 10% times it returns me a random value that has no relation with the post i do but 90% times returns the correct value... what's wrong here?
PS: I have a similar script that runs simultaneously but with other post, is this related with the error?
Thank you in advance!!