I have a PHP code, that will run a Select query to check if a particular personName is present. If it is present we should return a JSON stating so, and if not present we should send a JSON response stating the same.
My code so far;
$rst= mysql_query("select* from Person
where personname='Labby'");
while($r= mysql_fetch_array($rst) ){
// Now what ??
}
// How do i know if $rst= mysql_query("select* from Person , returned true or false ? and depending on that create a JSON response. How can i do this ?
where personname='Labby'");
Either switch your query to use
COUNT(*)and retrieve the value, or usemysql_num_rows()(or the mysqli or PDO equivalent).