Android Question [Resolved]Query result null

Douglas Farias

Expert
Licensed User
Longtime User
hi how can i return a echo 'noresult' in this code?
B4X:
<?

$databasehost = "localhost";
$databasename = "teste";
$databaseusername ="root";
$databasepassword = "";

$con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error());
mysql_select_db($databasename) or die(mysql_error());
mysql_query("SET CHARACTER SET utf8");
$query = file_get_contents("php://input");
$sth = mysql_query($query);

if (mysql_errno()) {
    header("HTTP/1.1 500 Internal Server Error");
    echo $query.'\n';
    echo mysql_error();
}
else
{
    $rows = array();
    while($r = mysql_fetch_assoc($sth)) {
        $rows[] = $r;
    }
    print json_encode($rows);
}
?>


i m runing this query

B4X:
Sub confereusuarioface
    ProgressDialogShow("Carregando...")
    ExecuteRemoteQuery("SELECT NickName,StatConta FROM usuarios Where SocID='" &idfacebook& "' and SocNet='" &fa& "' " , verificausuarioface)
End Sub


this user dont exist in my db and the php return nothing on result

Response: []


ok
but now how can i returne one error when dont have result on php ?

Response: erro < example
 

Douglas Farias

Expert
Licensed User
Longtime User
Solved i go use [] response
B4X:
        Case "verificausuarioface"
        ProgressDialogHide
        If cass = "[]" Then
        Msgbox("Não retornou nada :( " , "teste")
        Return False
        End If
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…