i am working on a marketing project.there are some category like bank ,school and many other and i have the same table in my sql database..now i am wanted to show the result of which category user click .. my index.php
<?php
$connection = mysql_connect('localhost', 'root', '');
$db = mysql_select_db('market', $connection);
?>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js">
</script>
<script type="text/javascript">
$('document').ready(function () {
$('a').click(function () {
var temp = $('a').attr('myval');
$.post('fetch.php', {
id: temp
}, function (data) {
$('#display').html(data);
var temp = null;
});
});
});
</script>
</head>
<body>
<ul>
<li>
<a href="javascript:return(0)" myval="school">
<h3>school</h3>
</a>
</li>;
<li>
<a href="javascript:return(0)" myval="bank">
<h3>Bank</h3>
</a>
</li>;
<!--many more......-->
</ul>
<div id="display"></div>
</body>
and its my fetch.php
<?php
$connection = mysql_connect('localhost', 'root', '');
$db = mysql_select_db('market', $connection);
$x = $_POST['id'];
$safex = mysql_real_escape_string($x);
$query = mysql_query("select * from $safex", $connection);
$result = "";
$result .= "<div id='display'>";
$result .= "<table border=\"1\">";
$result .= "<tr><th>Name</th><th>Password(encrypted)</th></tr>";
while ($row = mysql_fetch_array($query)) {
$result .= "<tr><td> {$row['id']}</td>" . "<td> {$row['name']}</td></tr></p>";
}
$result .= "</table>";
$result .= "</div>";
echo $result;
?>
and now my prblem is when i click on any link..its always show tie school data..but i want to show diffent table data on diffenent click..all fields name of all tables are same.. plz help....