[SOLVED] Dynamic Text Links -- MySQL/PHP
Posted: Sun Aug 08, 2004 9:17 pm
feyd | Please use
feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I have an 'items for sale' mysql database of categories (garden, outdoors, automotive, etc.) and their status (sold or selling) thats loads dynamic text links for each active category. My problem is querying the database, when a unique category is selected (or clicked on), I want to generate a page where categories = 'selection' and status = 'selling.' So it would list all of the items in the database.
Here is an example of what I have so far, however, they arent linked to anything, Im having problems generating a page from this point. Here is a link to the page:
http://www.onestopauctionshop.net/preview/ddtest.php
And here is the code:
==================================Code: Select all
<?
$username="name";
$password="pass";
$database="db";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM bookmark WHERE status='selling'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$category=mysql_result($result,$i,"category");
echo "<a href='http://onestopauctionshop.com/preview/category.php'>$category</a> | ";
++$i;
}
?>feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]