I have created an android application,by using this function in php i am creating a
a new user in database mysql.
function signUp($sName, $sMobile, $sAddress, $sEmail, $sPwd)
{
$sql = "insert into customers (name,mobile,address,email,pwd) values ('$sName','$sMobile','$sAddress','$sEmail','$sPwd')";
$run = $this->query($sql);
if ($this->result <= 0) {
return false;
} else {
return $this->json('DATA');
}
}
With the below function i am querying in database and returning the response in json format
function query($sql){
$query = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_assoc($query)){
$this->result[] = $row;
}
return $this;
}
but the response i am getting has an error i tried surpessing the warnings by using
@mysql_fetch_assoc($query)
It gave a proper response in browser but android gets null as response
Error:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in
Warning: Cannot modify header information - headers already sent by (output started at
Help required New to PHP. Thanks in advance