Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/39244-shop-item-display/
Share on other sites

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!";

?>

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/39244-shop-item-display/#findComment-189108
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/39244-shop-item-display/#findComment-189111
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.