Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
the error is giving me in the line of the WHILE cycle, I have tried to try different things but it keeps giving me this error

mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in

What I have tried:

<form method="post" action="book.php">
<input type ="hidde" name="send" value="ok">
<table border="0">
<tr>
<td>title</td>
<td><input type="text" name="titel" size="20" maxlength="50"></td>
</tr>
<td>autor</td>
<td>
	<select name="auteur">
		<?php
		$conection = mysql_query_connet("localhost","phpususer","php", "weblearning");
		$query ="SELECT auteursid, surnames, nome FROM auteur ORDER BY surnames";
		$results = mysql_query($conection, $query);
		while ( $row= mysqli_fetch_assoc($results)) {
			print("<option value=". $row["auteursid"]. ">" .$row["surnames"]. "".$row["nome"] ."</option");
		}
		mysql_close($conection);
		?>

	</select>
</td>
</tr>
<tr>
	<td> number of page </td>
	<td><input type="text" name="page" size="20" maxlength="50"></td>
</tr>
<tr>
	
	<td></td>
	<td><input type="submit" value="add"></td>
</tr>
</table>
</form>
Posted
Updated 26-May-20 6:18am

1 solution

I wish I had £1 for every time this question gets posted. If you check the documentation for PHP: mysql_query - Manual[^] you will clearly see that when the query statement fails the call returns the boolean value FALSE. Do not assume that your API calls always do what you think; check the return values first.
 
Share this answer
 
Comments
phil.o 28-May-20 19:15pm    
Have my virtual pound :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900