Hello, I am working on a project for online store but i am getting the error Fatal error: Call to a member function querry() on a non-object
i have tried everything i can think of, please help me, i am in a bit hurry.
Here's my code
init.php :
And here's my navigation.php :Code:<?php $host = 'localhost'; $user = 'root'; $password = ''; $database = 'store'; $db = mysql_connect($host, $user, $password, $database); $check = mysqli_connect_errno(); if ($check) { echo "Database Connection failed because of following error". mysqli_connect_error(); die(); } ?>
please help me as soon as you can.Code:<?php $sql= "SELECT * FROM categories WHERE parent = 0"; global $db; $pquery = $db -> query($sql); ?> <!--Nav Bar --> <nav class="navbar navbar-default navbar-fixed-top"> <div class="container"> <a href="index.php" class="navbar-brand">Online Store</a> <ul class="nav navbar-nav"> <?php while ($parent = $pquery -> mysqli_fetch_assc($pquery)): //While Statement?> <?php $parent_id = $parent['id']; $sql2 = "SELECT * FROM categories WHERE parent = parent_id"; $cquerry = $db->query ($sql2); ?> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle= "dropdown"><?php echo $parent['categories']; ?><span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <?php while ($child = mysqli_fetch_assoc($cquery)): //while statement?> <li><a href="#"><?php echo $child['category']; ?></a></li> <?php endwhile; // end of the while?> </ul> </li> <?php endwhile; //end of the while ?> </ul> </div> </nav>
Thank you in advance



Reply With Quote

Bookmarks