coder-x Posted August 8, 2009 Share Posted August 8, 2009 need help it says theres something wrong on this line }elseif (strtolower($match_fetch) != strtolower($username)){ can someone help me please it says this error Catchable fatal error: Object of class stdClass could not be converted to string in line 122 Link to comment https://forums.phpfreaks.com/topic/169320-catchable-fatal-error-object-of-class-stdclass-could-not-be-converted-to-string/ Share on other sites More sharing options...
trq Posted August 8, 2009 Share Posted August 8, 2009 What does $match_fetch and $username contain? One of them appears to be an object of type stdClass. Link to comment https://forums.phpfreaks.com/topic/169320-catchable-fatal-error-object-of-class-stdclass-could-not-be-converted-to-string/#findComment-893467 Share on other sites More sharing options...
coder-x Posted August 8, 2009 Author Share Posted August 8, 2009 What does $match_fetch and $username contain? One of them appears to be an object of type stdClass. if (strip_tags($_POST['play_id']) && strip_tags($_POST['Submit'])){ $play_id=strip_tags($_POST['play_id']); $match_info=mysql_query("SELECT * FROM matches WHERE id='$play_id'"); $num = mysql_num_rows($match_info); $match_fetch=mysql_fetch_object($match_info); if ($num == "0"){ echo "No such match."; }elseif ($num != "0"){ if ($match_fetch->bet > $fetch->money){ echo "You Havn't Got Enough Money To Play."; }elseif($match_fetch->bet <= $fetch->money){ if (strtolower($match_fetch->username) == strtolower($username)){ echo "You Cannot Have A Match Against Yourself!."; }elseif (strtolower($match_fetch) != strtolower($username)){ $oppon = mysql_fetch_object(mysql_query("SELECT * FROM user_info WHERE username='$match_fetch->username'")); $oppon_user = mysql_fetch_object(mysql_query("SELECT * FROM user_info WHERE username='$match_fetch->username'")); $wl=explode(":",$oppon->wl); thats all the code mate Link to comment https://forums.phpfreaks.com/topic/169320-catchable-fatal-error-object-of-class-stdclass-could-not-be-converted-to-string/#findComment-893469 Share on other sites More sharing options...
trq Posted August 8, 2009 Share Posted August 8, 2009 $match_fetch is an object. Try.... } elseif (strtolower($match_fetch->username) != strtolower($username)){ And please, use tags when posting code. Link to comment https://forums.phpfreaks.com/topic/169320-catchable-fatal-error-object-of-class-stdclass-could-not-be-converted-to-string/#findComment-893470 Share on other sites More sharing options...
trq Posted August 8, 2009 Share Posted August 8, 2009 In fact, you don't even need the elseif, your could replace that entire line with.... } else { Link to comment https://forums.phpfreaks.com/topic/169320-catchable-fatal-error-object-of-class-stdclass-could-not-be-converted-to-string/#findComment-893471 Share on other sites More sharing options...
coder-x Posted August 8, 2009 Author Share Posted August 8, 2009 $match_fetch is an object. Try.... } elseif (strtolower($match_fetch->username) != strtolower($username)){ And please, use tags when posting code. oh sorry im new here btw i tried that never worked it was }elseif (strtolower($match_fetch->match_fetch) != strtolower($username)){ it was match fetch Link to comment https://forums.phpfreaks.com/topic/169320-catchable-fatal-error-object-of-class-stdclass-could-not-be-converted-to-string/#findComment-893472 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.