last day (14 days later) » 

1:53 AM
0
Q: Trying to get property of non-object - PHP update

Renata P SouzaI'm with a doubt in return the type of user sex in your profile and it had to go looking for sex pack by entering the user id of sex but when trying to find, I receive an message error, Notice: Trying to get property of non-object <?php session_start(); include "../php/connect.php"; ?> <html> <...

 
I have try $p_id_sex = $result->ID_USER_SEX;and still the same
 
var_dump $result?
 
@Jessica, I put _to not to conflict with the $cursor and $result previously used
@Jessica, $result is defined to select the user for id and I used $result_ to select the sex for id
@frz3993, $resultis defined to select the user for id, now var_dump?
 
Yes, you tried to get the property of $result which caused the error. Shouldn't you at least check what is inside it ?
 
ok, but if I made p_id_sex = $result->ID_USER_SEX; after <tr> <td>ID Sex</td><td><input type=\"text\" size=\"48\" value=\"$result->ID_USER_SEX\" /></td></tr> the result is p_id_sex = 1
@frz3993, ok maybe you right and what you suggest?
 
1:53 AM
Hahaha, I'm also at lost here @RenataPSouza. Seems like it became a non-object after ?> <?php.
 
@frz3993, maybe you right
 
2:06 AM
Hello
The tags shouldn't be a problem.
I think.
 
ok
I chage name to result, cursor beacuse
has mane conflit
about this global variable
if I made this <tr>
<td>Sex Type</td><td><input type=\"text\" size=\"48\" value=\"\" /></td>
</tr>
everthyng is all right
if I If I put <tr>
value=\"$result->SEX_TYPE\" />
gave error
I update the post again and I put the more result with image, check
if is possible?
@Jessica, first you have right when I said "I have try $p_id_sex = $result->ID_USER_SEX;", honestly its worked in this part the error is in $result->SEX_TYPE
 

last day (14 days later) »