php - no data showing in query results -


so have database categories table in it. there 6 categories within table (power, logic, sensors, safety, operator interface, connection devices)

im trying make drop down within top navigation display these categories. thought simple select query grabbing categories , displaying them in drop down. way in future if more categories added automatically go navigation.

however data isnt appearing in menu, 6 blank areas data should there.

here sql.

$mysql_connection = db_connect_enhanced('xxxxx','dbaccess','brother','website');    //connect database         $categories = "select * rockwell.rae_categories active = 1";         $result = db_query_into_array_enhanced($mysql_connection, $categories);         $count = count($result); 

and here html , php display menu

    <div id="nav">         <ul>             <li><a href="<?=$base?>"><img src="images/nav-home.jpg"></a></li>             <li><a href="#.php"><img src="images/nav-products.jpg"></a>                 <ul>                     <?for($i = 0; $i < $count; $i++)                     {?>                         <?$row = mysqli_fetch_assoc ($result);?>                         <li><a class="dropdown" href="#"><?$row['categoryname']?></a></li>                     <?}?>                 </ul>                                                            </li>             <li><a href="faq.php"><img src="images/nav-faq.jpg"></a></li>             <li><a href="#.php"><img src="images/nav-contact.jpg"></a></li>             <li class="end"><a href="#.php"><img src="images/nav-delivery.jpg"></a></li>         </ul>     </div> 

does have ideas?

you need loop data.

while($row = mysqli_fetch_assoc($result)){        //your code } 

also replace

<?$row['categoryname']?> 

by

<?=$row['categoryname']?> 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -