php code to revealing levels of data
What I want is to display levels of data as one to navigate through my webpage. In other words, I want to show data in a database that links to other pages that displays more data so that the page can be organize in to a interface that displays categories and navigates through a database. I can actually get the data to display, but I cannot get the data to display data that is linked to a specific row.
Here is the data that through php:
<?php
require_once ('mysql_connect.php'); // connecting to database.
// Im making the query.
$query = "SELECT CONCAT(Id) AS Id, (Name) AS Name, (Description) AS Des, DATE_FORMAT(Date, '%M %d, %Y') AS dr FROM AddTable1 WHERE Description IS NOT NULL ORDER BY Date ASC";
$result = @mysql_query ($query) OR die; // Run the query.
$num = mysql_num_rows ($result); // How many codes are there?
if ($num >0)
{ // If it ran ok
// Display numbers
echo "<p><big><b>These are the current number of entries: $num</b></big></p>";
// Display headers
echo '<table align="center" border="2" cellspacing="2" cellpadding="2">
<tr><td align="left"><b>Id</b></td><td align="left"><b>Name</b></td><td align="left"><b>Category</b></td><td align="left"><b>Date</b></td><td></td><td align="left"><b>Click edit to update</b><td align="left"><b>Show the table</b></td></td></tr>';
// Fetch the data
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
echo "<form name=method='post' action='Show.php'>";
echo "<tr><td align=\"left\">".stripslashes($row[0])."</td><td>$row[1]</td><td align=\"left\"><a href='edit.php?=".edit."'>$row[2]</a></td><td align=\"left\">$row[3]</td><td align=\"left\"><a href='edit.php?=".edit."'>$row[4]</a></td><td><a href='edit.php?=".edit."'>".edit."</a><br></td><td><input type='submit' name='Code' value='".$result[Code]."Show'></td></tr>\n";
}
echo '</table>';
mysql_free_result ($result); // free up resources.
} else { // If it didnt run OK.
echo
'<p>there are no codes in this query</p><p>' .mysql_error() . '</p>';
}
mysql_close(); // Close the database.
include ('WSfooter.inc'); // footer included.
?>
Now here is the page that is supose to show that data that is linked to that to the above listing of data:
<?php
// This page is to get the sql query to show the table being selected
// The title and header
$page_title = 'Show information';
include ('WSheader.inc');
// Variable Declaration with if statement
$c = $_Get['Code'];
// Query time - for selection of data
require_once ('mysql_connect.php'); // I am making a connection to database
// Variable Declaration with if statement
// This query should show the data from agenda section
$result = mysql_query("SELECT Code FROM AddTable2 WHERE Code=" . $c);
if (!$result) {
die ("<p>Error performing query: " . mysql_error() . "</p>");
}
else {
echo ('<p> '.$result.'.</p>');
}
mysql_close(); // Close the database.
include ('WSfooter.inc'); //Showing footer
?>
I cannot get this one to display someone anyone please help me.
|