0

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

2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by monta2020
0

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.

Edited by monta2020: n/a

0

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

0

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.

0

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.

Attachments
<?php

$cm=$_GET['compname'];

echo "<center>";

$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("who_Database", $con);

$result = mysql_query("SELECT * FROM who_Database WHERE Category = 'Company' and company_name like '%".$cm."%'"); 

echo "<table width=900  border='2'>";
echo "<tr>";
echo "<br>";
echo "<br>";
echo "<br>";

echo "<th colspan=2>Company Information </th>";


$counter=1;
while($row = mysql_fetch_array($result))
  {

  echo "<tr>";
echo "<th colspan=2> Record Number $counter</th>";

$counter++;

  echo "<tr><td><b>&nbsp;&nbsp; History  </b></td><td width=300px>&nbsp;&nbsp;<a href=HistoryCompa.php?compname=" .  $row [10] ." >" .  $row ['History'] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp;Year of Operation </b></td><td >&nbsp;&nbsp;" .  $row [11] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp;Realtionship With WHO </b></td><td >&nbsp;&nbsp;" .  $row [12] ."</td></tr>";


  echo "</tr>";
  }

echo "</table>";

mysql_close($con);
echo " NYA = Not Yet Available";

//echo "<br><br><br><br><br><a href=listcompanies.php>Back</a>  
echo" <br>  <img src=image/test.bmp> ";
?>
<?php



echo "<center>";


echo "  <img src=image/mainpage.jpg> ";
echo"<br><br><a href=../try/MainPage.html><img src=image/home.jpg width=90 height=30></a>&nbsp;&nbsp;&nbsp;
<a href=../try/WHO.html><img src=image/insert.jpg width=90 height=30></a>&nbsp;&nbsp;&nbsp;
<a href=../try/ListCompanies.php><img src=image/Companies.jpg width=90 height=30></a>&nbsp;&nbsp;&nbsp;
<a href=../try/Search.html><img src=image/search.jpg width=90 height=30></a><br><br><br><br><br>";

echo" NO HISTORY RECORDED YET";






//echo "<br><br><br><br><br><a href=listcompanies.php>Back</a>  
echo" <br>  <img src=image/test.bmp> ";
?>
<?php
echo "<center>";
echo "  <img src=image/mainpage.jpg> ";
echo"<br><br><a href=../try/MainPage.html><img src=image/home.jpg width=90 height=30></a>&nbsp;&nbsp;&nbsp;
<a href=../try/WHO.html><img src=image/insert.jpg width=90 height=30></a>&nbsp;&nbsp;&nbsp;
<a href=../try/ListCompanies.php><img src=image/Companies.jpg width=90 height=30></a>&nbsp;&nbsp;&nbsp;
<a href=../try/Search.html><img src=image/search.jpg width=90 height=30></a>&nbsp;&nbsp;&nbsp;<a href=../try/listFoundations.php><img src=image/foundations.jpg width=90 height=30></a>&nbsp;&nbsp;&nbsp;<a href=../try/ListNGOs.php><img src=image/NGO.jpg width=90 height=30></a>";


$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("who_Database", $con);

$result = mysql_query("SELECT * FROM who_Database WHERE category='Company' ORDER BY Company_Name "); 

echo "<table width=600  border='2'>";
echo "<tr>";
echo "<br>";
echo "<br>";
echo "<br>";

echo "<th colspan=2>Companies </th>";

$counter=1;
while($row = mysql_fetch_array($result))
  {

  echo "<tr>";
echo "<td>".$counter."</td>";
$counter++;
  echo "  <td >  <a href=compinfo.php?compname=". $row ['Company_Name'] ."   >" .  $row ['Company_Name'] ."</a></td>";


  echo "</tr>";
  }

echo "</table>";

mysql_close($con);
echo "<br><br><br><br><br><br>  <img src=image/Smal.bmp > ";
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.