bravo14 Posted December 6, 2014 Share Posted December 6, 2014 Hi all i am using the code below, but am getting the error Object of class mysqli_result could not be converted to int <?php $sql="SELECT lng,lng_prefix FROM tbl_languages where active = 1"; $result=mysqli_query($dbConn, $sql)or die(mysqli_error($dbConn)); //problem line if(mysqli_num_rows($result==1)){ ?> The code continues with what I want to happen based on the result. What does the error mean and how do I fix it? Quote Link to comment https://forums.phpfreaks.com/topic/292934-object-of-class-mysqli_result-could-not-be-converted-to-int/ Share on other sites More sharing options...
maxxd Posted December 6, 2014 Share Posted December 6, 2014 You've got your end parenthesis in the wrong spot. change if(mysqli_num_rows($result==1)){ to if(mysqli_num_rows($result)==1){ and it should work. 1 Quote Link to comment https://forums.phpfreaks.com/topic/292934-object-of-class-mysqli_result-could-not-be-converted-to-int/#findComment-1498784 Share on other sites More sharing options...
kicken Posted December 6, 2014 Share Posted December 6, 2014 Your closing parenthesis for the function call is in the wrong spot. You're trying to call mysqli_num_rows on the result of the $result==1 comparison. 1 Quote Link to comment https://forums.phpfreaks.com/topic/292934-object-of-class-mysqli_result-could-not-be-converted-to-int/#findComment-1498785 Share on other sites More sharing options...
hansford Posted December 6, 2014 Share Posted December 6, 2014 Without correct parenthesis, you're code is being in interpreted as trying to cast the result set to an integer. Quote Link to comment https://forums.phpfreaks.com/topic/292934-object-of-class-mysqli_result-could-not-be-converted-to-int/#findComment-1498787 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.