View Full Version : retrieving selected data from mysql
Tjobbe
February 17th, 2005, 14:34
I have a menu with all the company names in a left hand column, when a company name is clicked, I'd like it to select all the details from that company.
How would I go about this? would the a href tag be a php link to the id of the company within the table or is it a bit more complex than that?
I have created the database no problems, and I know how to display everything from one ID at a time, but if I was to do this for each company, I wouldnt really be using php to its fullest potential.
Any advice? Thanks in advance.
Tjobbe
February 17th, 2005, 14:57
I have a menu with all the company names in a left hand column, when a company name is clicked, I'd like it to select all the details from that company.
How would I go about this? would the a href tag be a php link to the id of the company within the table or is it a bit more complex than that?
I have created the database no problems, and I know how to display everything from one ID at a time, but if I was to do this for each company, I wouldnt really be using php to its fullest potential.
Any advice? Thanks in advance.
here is my display.php which im using to display the company data, im planning on using this as an include, or something similar, so that "where id = 1" just changes to reflect the company name clicked.
[syntax:a6b8c4361a="php"]
<?php
include 'dbconnect.php';
$get = mysql_query("SELECT * FROM coname where ID = 1") or die("Mmm pie:" . mysql_error());
while ($row = mysql_fetch_row($get)) {
echo "<h4>Company Details</h4>\n";
echo "<img src=".$row[1].">";
echo "<p>".$row[2]."</p>";
echo "<p>".$row[3]."</p>";
echo "<p>".$row[4]."</p>";
echo "<p>".$row[5]."</p>";
echo "<p>".$row[6]."</p>";
echo "<p>".$row[7]."</p>";
echo "<p>".$row[8]."</p>";
echo "<p>".$row[9]."</p>";
echo "<p>".$row[10]."</p>";
echo "<p>".$row[11]."</p>";
}
?>
[/syntax:a6b8c4361a]
vBulletin® v3.6.8, Copyright ©2000-2010, Jelsoft Enterprises Ltd.