Here is my php script.. first it insert a row of data to the database. Then it takes that row again (in the same script). But now it returns 0 rows. However the row which was entered is exist in the database.
And also there are two rows which was created when I created the database. if I write a query to get that old rows, It returns values without problem. And also serverID and UserID work well.
$conn = new mysqli($sever, $uname, $pass, $dbname);
if ($conn->connect_error) {
die("Internal Server Error!");
}
//add new row
$un = $_POST['uname'] ;
$ue = $_POST['uemail'];
$up = $_POST['upass'];
$sql = "INSERT INTO TBuser (username, email, password, serverID)
VALUES('" . $un . "',' " . $ue . "',' " . $up . "', '1')";
$conn->query($sql);
if ($conn->query($sql) === FALSE) {
die("Internal Server Error! Ex000105 0 <br>" .
mysqli_error($conn) . '<br>'. $sql);
}
$sql = "SELECT * FROM TBuser WHERE email LIKE '" . $ue . "'";
$results = $conn->query($sql);
if ($results->num_rows == 0) {
die("Internal Server Error! Ex000105 1".
mysqli_error($conn) . '<br>'. sql . '<br>'
. mysqli_error ($conn) . '<br>'. $results->num_rows );
}
And here is my table. First two rows are created by another php script when the database create. Third row is created by above script.
mysqli_error($conn) did not return any error message.
Array ( [userID] => 1 [username] => namindu [email] => namindu@live.com [password] => oh!mygod [serverID] => 1 )
Array ( [userID] => 2 [username] => kamal [email] => namindus8@live.com [password] => oh!mygod [serverID] => 1 )
Array ( [userID] => 56 [username] => Namindu [email] => nn@h.com [password] => k [serverID] => 1 )
Thanks for helping.