I am trying to display a list of the book which category but is not running.

this is a piece of my code:

<?php 

require_once('auth.php');

$con=mysqli_connect("localhost","mag_install","mag123","mag_rocket");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$result = mysqli_query($con,"SELECT * FROM category");

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>

<table cellpadding="0" cellspacing="0" border="0" style="width:721px" align="center"> 
    <tr>
        <td>
            <table cellpadding="0" cellspacing="0" border="0" style="height:565px; background:#ffffff ">
                <tr>
                    <td><img alt="" src="images/spacer.gif" width="9" height="1"></td>
                    <td class="col_center" >
                        <table cellpadding="0" cellspacing="0" border="0">
                            <tr>
                                <td>
                                    <table cellpadding="0" cellspacing="0" border="0" class="cont_heading_table">
                                        <tr>
                                            <td><img src="images/cont_heading_tl.gif" alt="" border="0"></td>
                                            <td style="width:100%" class="cont_heading_t"></td>
                                            <td><img src="images/cont_heading_tr.gif" alt="" border="0"></td>
                                        </tr>
                                        <tr>
                                            <td class="cont_heading_l"><img alt="" src="images/cont_heading_l.gif"></td>
                                            <td style="width:100%" class="cont_heading_td cont_heading_td">Search Engine</td>
                                            <td class="cont_heading_r"><img alt="" src="images/cont_heading_r.gif"></td>
                                        </tr>
                                        <tr>
                                            <td><img src="images/cont_heading_bl.gif" alt="" border="0"></td>
                                            <td style="width:100%" class="cont_heading_b"></td>
                                            <td><img src="images/cont_heading_br.gif" alt="" border="0"></td>
                                        </tr>
                                    </table>
                                    <br style="line-height:9px">
                                    <table cellpadding="0" cellspacing="0" border="0" style="border:1px solid #FFFFFF; border-width:0 14px 0 27px" class="product">
                                        <tr>
                                            <td>
                                                <form action="result_page.php" method="POST">
                                                <b>Search By : Author</b> <br> <input type="text" name="Author" size="20"> <br><br> 
                                                <b>Search By : Title</b> <br> <input type="text" name="Title" size="20"> <br><br>
                                                <b>Search By : Category</b><br><br>



                                       <select name="Category">

                                        <option value="None">None</option>
                                        <?php while($row = mysqli_fetch_array($result)) {

                                                    $name = $row["Name"];

                                        ?>

                                                <option value="<?php echo $name ?>"><?php echo $name ?></option>

                                        <?php } ?>

                                        </select>
                                                <br><br>
                                                <input type="submit" value="Search">
                                            </form>
                                            <br>
                                            <table cellpadding="0" cellspacing="0" border="0">
                                                <tr>
                                                    <td class="line_x"><img alt="" src="images/spacer.gif" width="1" height="1"></td>
                                                </tr>
                                            </table> 

                                        </td>
                                    </tr>
                                </table> 
                            </td>
                        </tr>
                    </table>
                 </td>
                <td><img alt="" src="images/spacer.gif" width="9" height="1"></td>
            </tr>
        </table>
      </td>
</tr>

</table>
</body>
</html>

**error
Notice: underfined variable: on line 200
warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given on line 200

Your error states that the problem occures on line 200, but you've only posted 103 lines of code? Could you post all of the code please.

The only fetch is on line 67, so I'm guessing it's that one. It's strange though that the error says "null given".

Whats the output from:

$row_cnt = mysqli_num_rows($result);
echo $row_cnt;

?

this is the whole my code, but i cannot understand why the error is on line 200

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.