Trying to get property of non-object

slpixe

New Member
Messages
23
Reaction score
0
Points
0
Hey all,

On multiple Ajax applications I have been trying to run.

I'm constantly getting this error

"Trying to get property of non-object"

The applications are all returning an error on
Code:
    if($result->num_rows)

I'm having a feeling it could be to do with my php rights.
I'm currently on level 2, so I don't feel I should be having these errors.


Could someone confirm if this is a php level problem.
Or if there is an alternative method of code I need to do.



Thanks in advance
 

slpixe

New Member
Messages
23
Reaction score
0
Points
0
Is there anywhere else I could post this on or under that would be helpful to getting an answer or solution?

Thanks in advance.
 

crisp

New Member
Messages
85
Reaction score
0
Points
0
Try adding a check before that call to make sure the result is populated

Code:
if (!$results) return;
That's assuming you want it to return false to the Ajax call, of course, otherwise add a bit of logic...
Code:
if (!$results) {
    // do something when there's no results
} else {
    // handle the results
    if ($results->num_rows) 
}
 
Last edited:

marshian

New Member
Messages
526
Reaction score
9
Points
0
I'm guessing $result is a mysql result?
If so, make sure you've used mysql_fetch_object(), and not mysql_fetch_array(). That could be the problem (Arrays are not objects in php as far as I know)
 

slpixe

New Member
Messages
23
Reaction score
0
Points
0
yes $result is the mysql result.

I'm going to try a few things, I did find something about the difference between mysql
and mysqli.

Does x10 provide support for mysqli?
I'm starting to think all the $this->mMysqli-> are causing the problems..
 
Top