i have two tables title and words
in title i have id and word
in words i have id, title, description, example, synonym, user
i'm trying to display word from table title as a link which displays all rows in table words which has a same title with the word in table title (title.word = words.title)
here is my code for view.html
Code: Select all
<html>
<head></head>
<link href="dirty money.css" rel="stylesheet" type="text/css">
<body>
<div id="wrapper">
<div id="header"></div>
<div id="navigation">
<p id="menu">
<a href="last.php">Oxirgi kiritilganlar</a> <a href="add.html">Kirit</a> <a href="chat.php">Chat</a> <a href="themes.php">Temalar</a> <a href="titles.html">So`zlarni ko`rish</a>
</p>
</div>
<div id="leftcolumn">leftcol</div>
<div id="content">
<p id="main">
<?PHP
$connection = mysql_connect("***********", "*******", "*******") or die(mysql_error());
mysql_select_db("a1791845_jargon") or die(mysql_error());
$word = "SELECT title.word, words.title, words.id FROM words, title WHERE title.word = words.title";
$result = mysql_query($word, $connection);
while($row = mysql_fetch_assoc($result)){
?>
<a href="view.php?id=<?PHP echo $row['id']; ?>"><?PHP echo $row['word']; ?></a>
<?PHP } ?>
</div>
<div id="footer">footer</div>
</div>
</body>
</html>
Code: Select all
<?PHP
$connection = mysql_connect("mysql6.000webhost.com", "a1791845_user", "123jargon") or die(mysql_error());
mysql_select_db("a1791845_jargon") or die(mysql_error());
$word = "SELECT * FROM words WHERE id = '".mysql_real_escape_string($_GET['id'])."'";
$result = mysql_query($word, $connection);
$row = mysql_fetch_assoc($result); {
echo "<br/><u><b>".$row['title']."</b></u><br/>".$row['descr']."<br/><i>".$row['example']."</i><br/>".$row['synonim']."<br/>".$row['user']." qo`shdi.<br /><br />";
}
?>
id=1, word=car
id=2, word=apple
the table words has these
id=1, title=car and etc
id=2, title=car and etc
when i open the view.html file, it is showing tow cars as link like car car cuz i have two records with the title car in table words
what i want is to display it for once and when it is clicked, it shows info about all records with title 'car'
thanks!