tekcap Posted February 20, 2007 Share Posted February 20, 2007 Hello, im trying to figure out how to display my dynamically loaded products from a mysqldatabase. This site displays the products in the fashion that im looking for. http://www.phonicarecords.co.uk/genre.aspx?CatID=3 What is neccerary for accomplishing something like this? Does it go beyond php? requiring work in photoshop before hand? Quote Link to comment https://forums.phpfreaks.com/topic/39244-shop-item-display/ Share on other sites More sharing options...
printf Posted February 20, 2007 Share Posted February 20, 2007 Sorry, without seeing your database structure one could only guess... printf Quote Link to comment https://forums.phpfreaks.com/topic/39244-shop-item-display/#findComment-189094 Share on other sites More sharing options...
tekcap Posted February 20, 2007 Author Share Posted February 20, 2007 If by Database structure you mean my tables well I can have something done in a few days. Quote Link to comment https://forums.phpfreaks.com/topic/39244-shop-item-display/#findComment-189099 Share on other sites More sharing options...
tekcap Posted February 20, 2007 Author Share Posted February 20, 2007 I have this so far. Would it be better put Artist, Label, Genre in there own table? <?php mysql_connect("localhost", "username", "password") or die(mysql_error()); echo "Connected to The Vault<br />"; mysql_select_db("database") or die(mysql_error()); echo "Connected to The Vault Database"; mysql_query("CREATE TABLE song( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), genre VARCHAR(20), title varchar(50), artist varchar(30), label varchar(40) sample_file_reference varchar(80), full_file_reference varchar(80), image_reference varchar(80), sold_count int(6), reviews or die(mysql_error()); echo "Table Created!"; mysql_query("CREATE TABLE transaction( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), music_id) int(12), purchase_date date, username varchar(15), or die(mysql_error()); echo "Table Created!"; mysql_query("CREATE TABLE users( id INT NOT NULL AUTO_INCREMENT, username varchar(15), password varchar(20), first_name varchar(20), last_name varchar(20), address varchar(64), city varchar(32), province varchar(32), country varchar(32), postalcode varchar(32), phone varchar(32), email varchar(40), or die(mysql_error()); echo "Table Created!"; mysql_query("CREATE TABLE administrator( username varchar(15), password varchar(20), or die(mysql_error()); echo "Table Created!"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/39244-shop-item-display/#findComment-189108 Share on other sites More sharing options...
marcus Posted February 20, 2007 Share Posted February 20, 2007 For creating databases I would use phpMyAdmin to make it a lot easier and much faster. And to display your entries it would consist of a mySQL query and a while statement. For your query statement you just do $artist = mysql_real_escape_string($_GET[artist]); $query = mysql_query("SELECT * FROM `songs` WHERE `artist` ='$artist'"); Obviously you can change it to whatever you what. And for the while statement you would do something along the lines of: echo "<table border=0 cellspacing=3 cellpadding=3 width=500>\n"; echo "<tr><td colspan=4 align=center>$artist\'s Albums</td></tr>\n"; $x=0; while($row = mysql_fetch_assoc($query)){ if($x == 4){ echo "</tr><tr>\n"; } echo "<tr><td><a href='view_album.php?id=$row[id]'><img src='$row[artist]/$row[album].gif' border='0'></a><br>$row[album]</td>\n"; $x++; } echo "</table>\n"; Something like that. Quote Link to comment https://forums.phpfreaks.com/topic/39244-shop-item-display/#findComment-189111 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.