hi, im new to php, and i'm very 😕 . For my site i decided to add a ringtone section, so i've made the actual database, but i am having trouble retrieving the info
heres the code ive got at the mo:
<html>
<head>
<title>CyberPlebs</title>
<STYLE type="text/css">
#P { font: 9pt Verdana,Helvetica,Arial }
#TD { font: 9pt Verdana,Helvetica,Arial }
.noline {a:Verdana,Helvetica,Arial,Sans Serif;font-size:10pt;color:#000000;text-decoration:none;}
A:hover { color:#3399FF; }
</STYLE>
<style>
<!--
a{text-decoration:none}
//-->
</style>
</head>
<body bgcolor="#000000" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<?php
$db = mysql_connect("localhost", "username", "password");
mysql_select_db("username_db",$db);
// display individual record
if ($id) {
$result = mysql_query("SELECT * FROM ringtone WHERE id=$id",$db);
$myrow = mysql_fetch_array($result);
printf("Title: %s\n<br>", $myrow["title"]);
printf("Band: %s\n<br>", $myrow["band"]);
printf("RingTone: %s\n<br>", $myrow["ringtone"]);
printf("Tempo: %s\n<br>", $myrow["tempo"]);
printf("Category: %s\n<br>", $myrow["Category"]);
}
else {
// show employee list
$result = mysql_query("SELECT * FROM ringtone",$db);
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
do {
printf("<a href=\"%s?id=%s\">%s %s</a><br>\n", $PHP_SELF, $myrow["id"], $myrow["title"], $myrow[""]);
} while ($myrow = mysql_fetch_array($result));
} else {
// no records to display
echo "Sorry, no records were found!";
}
}
?>
</body>
</html>
this code kinda works, i the ID bit at the top i want to keep, but the bit below that i want changed
I want it changed so that if the query is ?Category=<a category name here> it brings up all the names of the different bands that have made a tune in that Category, and if there is no band, it shows the titles of the induvidual ringtone in that category
also,
I want it changed so that if the query is ?Band=<a band name here> it brings up all the titles of the ringtones made by that Band
also,
I want it changed so that if the query is nothing it brings up all the different Categories
... I know it's a lot to ask, but i would be very gratefull if anyone can make the code for me that does that.....Thanks in advance 🙂