Created
August 15, 2013 00:56
-
-
Save sivaprabug/6237328 to your computer and use it in GitHub Desktop.
mysqli returns empty result - how to display ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$q2 = "SELECT FIELD FROM TABLENAME WHERE ID = 1;"; | |
$con = new mysqli($server, $user, $pass); | |
if (mysqli_connect_errno()) | |
{ | |
$error = mysqli_connect_error(); | |
exit(); | |
} | |
else | |
{ | |
$res = mysqli_query($con, $q2); | |
$row_cnt = mysqli_num_rows($res); | |
if ($row_cnt == 0) | |
{ | |
PRINT "THERE WAS NO RESULT: "; | |
} | |
else | |
{ | |
if ($res) | |
{ | |
while($row = mysqli_fetch_assoc($res)) | |
{ | |
PRINT "THERE WAS A RESULT HERE: "; | |
} | |
} | |
else | |
{ | |
$error = mysqli_error(); | |
exit(); | |
} | |
mysqli_free_result($res); | |
} | |
}; | |
mysqli_close($con); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment