tjmaxwell
-
Posts
2 -
Joined
-
Last visited
Never
Posts posted by tjmaxwell
-
-
Hello.
Sorry to resurrect an old topic, but this is the same kind of thing I'm trying to do. I've searched this forum and have found a couple of code samples, but I can't get them to work. Here's what I have so far:
[code]<html>
<body>
<?php
// listing script
// connect to the server
mysql_connect( 'localhost', 'user', 'pass' )
or die( "Error - Could not connect to database: " . mysql_error() );
// select the database
mysql_select_db( 'dbname')
or die( "Error! Could not select the database: " . mysql_error() );
$RID = $_GET['ID'];
$query = "SELECT * FROM `model_numbers` WHERE `ID`='$RID'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
echo $row[title];
?>
<table border="1" cellpadding="3" cellspacing="3">
<tr>
<th align="left">Manufacturer</th>
<td align="left"><?php echo($Manufacturer) ?></td>
</tr>
<tr>
<th align="left">Warranty</th>
<td align="left"><?php echo($Warranty) ?></td>
</tr>
<tr>
<th align="left">Weight</th>
<td align="left"><?php echo($Weight) ?></td>
</tr>
</table>
</body>
</html>[/code]
I have a product database that contains about 40 fields, and about 15 columns per product. I was trying this code without success. I'm very new to PHP and was wondering if when you select all records, you need to display them all at once? In other words, are my scripts not working because I'm only displaying three of the columns? Any help to get this working would be much appreciated. I want to create one PHP page that is dynamically populated based on the ID field. I want users to be able to go to www.domain.com/products.php?id=(number). Thanks a lot!
Display selected record that has been passed to URL
in PHP Coding Help
Posted