Jump to content

some ideas, Please


Recommended Posts

Hello; :):) i'd like to you some ideas plaese.i got a table in database, and their structure as following;table name: BookCid Topic Content1 ss ss2 ss ssI want to display all the topic from the database into a table. if i click on a topic, then i can known the correspondence's Cid, and base on that, i willdisplay the correspondence Content.And the table should like the link has a table picture The problem for me, in website, what kind of knowledge can help me to has a table like i say? :eek:

Link to comment
Share on other sites

I have no clue what you are trying to do, so this is a guess. It seems to me like you want to display all of the topic names in links and make it so you can click the link to view the content. do this for the links:

<?php$links_query = mysql_query("SELECT * FROM `book` ORDER BY `Cid` DESC");while($links = mysql_fetch_object($links_query)){	echo "<a href=\"other_page.php?topic={$links->Cid}\">{$links->Topic}</a><br />";}?>

That should print out a list with links. Other_page.php:

<?phpif(isset($_GET['topic'])){$topic_content = mysql_fetch_object(mysql_query("SELECT * FROM `Book` WHERE Cid = {$_GET['topic']}"));echo "{$topic_content->Topic}<hr />{$topic_content->Content}";}else{//do something if they havent selected a topic}?>

Viola!:) that should work..

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...