
Originally Posted by
ron bennett
I have a database with columns for name, keyword, description, and link.
I have the following code to search the database and want it to make the name a link, but the link doesn't match the 'link' row in the database, all I get is the same link for all the names. I'm still new at PHP, and I have no idea what I've done wrong here. Can anyone help? Thanks in advance.
$result = mysql_query("SELECT * FROM products where keyword like '%$look%' ");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
exit();
}
while ( $row = mysql_fetch_array($result) ) {
?><a href="<?php ($row["link"]) ?> "><?php echo("<P>" . $row["name"] . "</P>");
?></a>
<?php
echo("<P>" . $row["description"] . "</P>");
?><hr color="0066ff"> <?php
}
?>
try changing
PHP Code:
<?php ($row["link"]) ?>
to
PHP Code:
<?php echo($row["link"]); ?>
Bookmarks