Posts: 77
Name: Daniel
Location: Stony Point , Noth Carolina
|
im using the following code to try and generate a dynamic navigation menu. It will generate the menu right, but i dont know how to make my data appear on the pages. I am missing something. I want to display what is in the "string" on the page. I am thinking i need to create a variable to hold the data ,but how do i do that? Please help me. I found this class on the internet, and I would love to use it on my website. Thanks so much for any help you can offer. here is where i found the code on the net. It is a tutorial on how to create a dynamic nav menu.
Code:
http://www.onlamp.com/pub/a/php/2000/11/02/next_previous.html?page=1
Code:
<?php
// database connection stuff
$db = mysql_connect("localhost","user","pass");
mysql_select_db("GraphicsDB", $db) or die(mysql_errno() . ": " . mysql_error() . "<br>");
// including the navbar class
include("navbar.php");
// initiate it!
$nav = new navbar;
// set how many records to show at a time
$nav->numrowsperpage = 1;
$sql = "SELECT string FROM Graphics ORDER BY id ASC ";
$sql_Result = mysql_query($sql,$db) or die(mysql_error() );
// the third parameter of execute() is optional
$result = $nav->execute($sql, $db, "mysql");
// handle the returned result set
$rows = mysql_num_rows($result);
for ($y = 0; $y < $rows; $y++) {
$data = mysql_fetch_object($result);
echo $row1;
echo $data->url . "<br>\n";
}
echo "<hr>\n";
// build the returned array of navigation links
$links = $nav->getlinks("all", "on");
for ($y = 0; $y < count($links); $y++) {
echo $links[$y] . " ";
}
?>
__________________
What is Yuwie?
Please login or register to view this content. Registration is FREE
|