I need to add another variable into the url, i dont completly understand this i just use it, but i need the url to have the title of the page and a username associated with it. Bit confusing.
here is the code:
<?php
function nav()
{
include("dbconnect.inc");
$sql = "SELECT * from pages where title = '$_GET[id] AND username = '$_GET[username]'";
$result = mysql_query($sql, $conn);
echo "<table id='tnav' width='100%' cellspacing='0' cellpadding='0' style='padding-top: 0px;'>";
while ($row = mysql_fetch_assoc($result))
{
printf("<tr><td id='nav'><a title='$row[title]' href=\"%s?id=%s\">%s</a></td></tr>\n","pages.php", $row["title"],$row[title]);
}
echo "</table>";
}
?>
tried to exchange the other $row[title] for $row[username] but no luck, basically i want a web page to bring up deifferent results based on the username?
If it makes sense?
here is the page im trying to display it all, bare in mind that the table in the database has 4 columns, id (pk, auto increment), username, title, content.
<?php
include("dbconnect.inc");
include ("nav.php");
$sql = "SELECT * from pages where username = '$_GET[username]'";
$result = mysql_query($sql, $conn);
$row = mysql_fetch_assoc($result);
?>
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<center>
<table class="surround" cellspacing="0" cellpadding="0">
<tr>
<td class="head" colspan="2">
</td>
</tr>
<tr><th class="nav_h"> Navigation</th><th class="nav_h"><?php echo $row[title]; ?></th></tr>
<tr><td height="3px"></td></tr>
<tr>
<td width="15%" valign="top">
<?php echo nav(); ?>
</td>
<td class="content" align="left" valign="top">
<?php echo $row[content]; ?>
</td>
</tr>
</table>
</center>
</body>
<center>
</html>