hello guys ,

i have a table created in php and within this table there's a liked word that will lead to it's topic , and this topic would be stored in the database. then when it's clicked it will show a page and display what has being stored in the database .

now i need some1 to help me in how to get the data from the database when the linked word being clicked and get a result out as :-


History click then the result would be HISTORY :- in 1919 we have had some one called monta and he is asking some of his friends to help his getting his project out and ask them about how to get information or data that being stored... so on. U all got what i mean right :) lolss cool.

thanks

Recommended Answers

All 5 Replies

what are the field u are using to stored the data in ur DB

this field is textbox... the information will be entered once by the admin through textbox and then stored in the database . when the user wants to view it he will click on the link that will disply the stored information in web page.

Hi

main.php

<?php 
$hostname = "localhost";
$database = "dbname";
$username = "root";
$password = "";

$conn = mysql_connect($hostname, $username, $password) or die(mysql_error());
mysql_select_db($database, $conn);

		 $conq="select * from tablename order by id";
					//echo $q;
	 	 $conr=mysql_query($conq,$conn);
	 	 $i=1;
		while($conm=mysql_fetch_array($conr)){ ?>
		<a href="desc.php?id=<?php echo $conm["id"]; ?>"><?php echo $conm["title"]; ?></a>
		<?php } ?>

desc.php

<?php

$hostname = "localhost";
$database = "dbname";
$username = "root";
$password = "";

$conn = mysql_connect($hostname, $username, $password) or die(mysql_error());
mysql_select_db($database, $conn);

$qry="select * from tablename where id='".$_REQUEST["id"]."'";
$res=mysql_query($qry,$conn);
$row=mysql_fetch_array($res);
?>


<?php echo $row["description"];?>

Pls try this

i didn't know how to work this while i don't have IDs in my DB cuz um using only 1 table in my BD.

i will attach yu the code um using so that it would be easier for u to help.

find out the atteched files to understan what i need.

here's the explanation:-

file 1 is listCompanies.php which will listdown the companies stored in the database and its linked to file compainfo.php wich will give me the information for the company that i click on its name. then within this information will be History .. which also clickable and when i click on it, it would get me the data that stored in the database table called who_Database in Column called History, and display it within the 3rd file named HistoryTcompa.php

thanks. i hope its all clear.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.