carleihar Posted November 14, 2009 Share Posted November 14, 2009 I get this error: An error occurred in script '/home/content/e/q/u/equianadmin/html/htdocs/pages/my_barn.php' on line 21: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given for this line of code: $row = @mysqli_fetch_array ($r, MYSQLI_NUM); I've also gotten this same error for this line of code: if (mysqli_num_rows($r) == 1) { What am I doing wrong? Thanks so much! Link to comment https://forums.phpfreaks.com/topic/181463-error/ Share on other sites More sharing options...
Garethp Posted November 14, 2009 Share Posted November 14, 2009 Well show us what $r is. Man, how can you expect us to help you if you don't give us the basics of what we need. Basically, it wants $r = myqsli_query("Something"); but it's not Link to comment https://forums.phpfreaks.com/topic/181463-error/#findComment-957249 Share on other sites More sharing options...
carleihar Posted November 14, 2009 Author Share Posted November 14, 2009 First time: $q = "SELECT COUNT(horse_name) FROM horses WHERE user_name = {$_SESSION['username']}"; $r = @mysqli_query ($dbc, $q); $row = @mysqli_fetch_array ($r, MYSQLI_NUM); Second time: $hn = $_GET['hn']; $q = "SELECT CONCAT('horse_name, 'user_name') AS info FROM horses WHERE horse_name = $hn"; $r = mysqli_query ($dbc, $q); if (mysqli_num_rows($r) == 1) { Link to comment https://forums.phpfreaks.com/topic/181463-error/#findComment-957389 Share on other sites More sharing options...
mga_ka_php Posted November 14, 2009 Share Posted November 14, 2009 from $q = "SELECT CONCAT('horse_name, 'user_name') AS info FROM horses WHERE horse_name = $hn"; to $q = "SELECT CONCAT('horse_name, 'user_name') AS info FROM horses WHERE horse_name = '$hn'"; see the ' at $hn Link to comment https://forums.phpfreaks.com/topic/181463-error/#findComment-957433 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.