I have a page that automatically runs a query and displays the results on the page. What i would like to do is that when click on one result, it should show me more details on that specific item on the same page (perhaps in a div), but i don't want to code a div/page for each specific item because i get results from a database that is ever growing.
this is how my php that displays the result looks:
while($row = mysql_fetch_array($result)){
if (strlen($row['companyname'])>0) {
echo "<ul data-role='listview' data-inset='true'>
<li><a href='#'>
<h3>{$row['companyname']}</h3>
<p><b>Address:</b></p>
<p><b>Tel:</b>{$row['tel']} <b>Fax:</b>{$row['fax']}</p>
<p><b>Email:</b>{$row['email']}</p>
<p><b>Website:</b>{$row['website']}</p>
<p class='ui-li-aside'><strong>VIEW MORE</strong></p>
</a></li>
</ul>";
I tried putting this code below in the href attribute, but it still doesn't work, and it will leave the page which i don't want to happen:
<a href="resultdetails.php?companyname='{$row['companyname']}"
Then i get the result on the next page like this:
$companyname = intval($_GET['companyname']);
$query = mysql_query("SELECT * FROM businessuser WHERE companyname=$companyname");
$details = mysql_fetch_array($query);
echo ($details[companyname]);
echo ($details[website]);
echo ($details[tel]);
This only ever give the first result in my table, no matter which result i click :(
Please help...thanks