mysql_fetch_assoc():提供的参数不是有效的MySQL [重复]

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

</div>

You can't get result by

Insert Query
but you can get id of current inserted user by
mysql_insert_id()
and then you can use "Select Query" against that id.

INSERT QUERY does not return RESULT SET

Only SELECT query returns result set

Well, the thing is that Your query is INSERT query and, according, to PHP Manual, in successful query it return true, not mysql object. So function "mysql_fetch_assoc($query)" cannot be ran because it requests mysql object as parameter not only TRUE.
Also, I recommend to start using MySQLi or PDO extensions, instead of mysql_* functions.

For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error.

For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error.

The returned result resource should be passed to mysql_fetch_array(), and other functions for dealing with result tables, to access the returned data.

Use mysql_num_rows() to find out how many rows were returned for a SELECT statement or mysql_affected_rows() to find out how many rows were affected by a DELETE, INSERT, REPLACE, or UPDATE statement.

mysql_query() will also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query.