Hi All, I am experiencing the following error while running the code mentioned. Can anyone please help? Warning: mysqli_fetch_array() [function.mysqli-fetch-array]: The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in /home7/example/public_html/test/archives/test9.php on line 83 Code (markup): <?php require_once "../../mysql/connect/connect_to_mysql.php"; $sql = 'SELECT linkurl, h1tag, writ, lastmodified, h2tag FROM newarchive ORDER BY id DESC'; $result = mysqli_query($myConnection, $sql) or die (mysqli_error($myConnection)); $row = mysqli_fetch_array($result) or die(mysql_error()); mysqli_close($myConnection); ?> <html> <head> <title></title> </head> <body> <?php $counter = 2; while ($row = mysqli_fetch_array( $result, $counter <= 1048576 )) { // line 83 echo "<div class='newtruc'><div class='bytitle'>"; echo '<a href="' . $row['linkurl'] . '">' . $row['h1tag'] . '</a><br />'; echo "</div>"; echo "<div class='byline'><span class='byline1'>"; echo "written by: "; echo $row ['writ']; echo "</span>"; echo " | "; echo "<span class='byline2'>"; echo $row['lastmodified']; echo "</span></div>"; echo "<div class='byphrase'>"; echo $row ['h2tag']; echo "</div></div>"; $counter = $counter * 2; } ?> </body> </html> Code (markup):
The 2nd parameter for mysqli_fetch_array can be one of the following : MYSQLI_ASSOC, MYSQLI_NUM, or MYSQLI_BOTH. So replace $counter <= ... with the appropriate of the 3 mentioned. Or better yet tell us what you are trying to do and maybe we can suggest a better solution for you.