wietsed
08-24-2006, 05:39 PM
I have two questions about MySQL.
I'm only two days into MySQL and having great fun with it, but..I'm running into two problems.
I have build a database with my CD's.
The fields are:
band, album, songs, released.
So far so good :)
Now I also made a webpage with three frames (I know...I'm just playing with it), a topmenu, submenu on the left and the main window.
I have made a dropdown menu in the topmenu containing all the bands.
When I select a band, it's albums are being displayed in the submenu.
So far so good :)
Here is the PHP script that displayes the album (from the Band selected at the topmenu).
<html><head>
<link rel=stylesheet href="styles.css" type="text/css">
</head>
<body>
<div class="album_menu">
<?php
mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("mp3albums") or die(mysql_error());
$bandselected=$_GET['SelectBand'];
$query = "SELECT * FROM albums";
$result = mysql_query("SELECT * FROM albums
WHERE band='$bandselected'") or die(mysql_error());
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$selectedbandalbum=mysql_result($result,$i,"album");
echo $selectedbandalbum;
echo "<hr>";
$i++;
}
?>
</div>
</body>
</html>
Now my first MySQL question is this.
How do I create dynamic links from the album(s) displayed?
This is what I want it to do.
When I click on an album (in the submenu) I want more info about this CD to be displayed in the main window (songs, released etc)
Is this possible? If yes, how?
Now my second question.
Is it possible to store images in a database?
if yes, how?
OK, that's it for now.
Hope someone will take the time to help :D
I'm only two days into MySQL and having great fun with it, but..I'm running into two problems.
I have build a database with my CD's.
The fields are:
band, album, songs, released.
So far so good :)
Now I also made a webpage with three frames (I know...I'm just playing with it), a topmenu, submenu on the left and the main window.
I have made a dropdown menu in the topmenu containing all the bands.
When I select a band, it's albums are being displayed in the submenu.
So far so good :)
Here is the PHP script that displayes the album (from the Band selected at the topmenu).
<html><head>
<link rel=stylesheet href="styles.css" type="text/css">
</head>
<body>
<div class="album_menu">
<?php
mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("mp3albums") or die(mysql_error());
$bandselected=$_GET['SelectBand'];
$query = "SELECT * FROM albums";
$result = mysql_query("SELECT * FROM albums
WHERE band='$bandselected'") or die(mysql_error());
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$selectedbandalbum=mysql_result($result,$i,"album");
echo $selectedbandalbum;
echo "<hr>";
$i++;
}
?>
</div>
</body>
</html>
Now my first MySQL question is this.
How do I create dynamic links from the album(s) displayed?
This is what I want it to do.
When I click on an album (in the submenu) I want more info about this CD to be displayed in the main window (songs, released etc)
Is this possible? If yes, how?
Now my second question.
Is it possible to store images in a database?
if yes, how?
OK, that's it for now.
Hope someone will take the time to help :D