Jump to content

Linking data and generating new pages


Schlo_50

Recommended Posts

Hello everyone!

 

Ok, so i have seen websites that have data stored in databases and when a link is clicked a template page is generated with the data instead of having a separate page for every single item associated with a user. The address bar when clicked will look something like this:

 

http://www.blahblah.com/user/index.php?id=view&&1918373707

 

I have two flat file databases. One, categories with the structure --> username|catname|catid and the other content with the structure  --> username|catid|date|text

 

I need some code please that will make a link between the 'catid' in both databases and then do that URL thing above to link to a generated page (or template page) where i can then echo out all information. I will post the code to show you how i am producing the links that i want people to click.

 

function displaytab(){

  $lines = file("usertabs.txt");
  foreach ($lines as $line) {
    $data = explode("|", $line); 
    if (current($data) == $_SESSION['userName']) { 
$name = next($data);
$catid = next($data);
$date = next($data);
$sitead = "http://localhost/books1/area/index.php";
$_SESSION['id'] = $id;

?>
<link href="style.css" rel="stylesheet" type="text/css" />

<table width="237" background="images/tab.png" border="0" cellpadding="1" cellspacing="0" class="main"> 
<tr> 
<td width="58"><div align="left"><a href="?id=view&&<?php echo "$id";?>"><?php echo "$name"; ?></a></div></td>
<td width="175" class="main"><div align="right"><a href="?id=display"><img src="../images/edit.png" width="25" height="25" border="0" /></a> <a href="?id=del"><img src="../images/del.png" width="25" height="25" border="0" /></a></div></td>
</tr> 
</table>

 

Any help?

 

Thanks for anything posted!

Link to comment
https://forums.phpfreaks.com/topic/79416-linking-data-and-generating-new-pages/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.