Many thanks void_function for your replies.
I’ll try to make it a bit more clear on what I’m trying to accomplish.
This is my MySQL database (localhost > test > testing):
Category | Banner | Info
Stuff | Banner 2 | Text
Things | Banner 1 | Text
Things | Banner 1 | Text
Things | Banner 1 | Text
Stuff | Banner 2 | Text
Stuff | Banner 2 | Text
This is my main menu:
<a href="?SC=Stuff.php-UK.php">Stuff</a>
<a href="?SC=Things.php">Stuff</a>
when I click stuff.php I what to output:
Banner | Info
Banner 2 | Text
Banner 2 | Text
when I click Things.php I what to output:
Banner | Info
Banner 1 | Text
Banner 1 | Text
This is my coding so far which doesn’t seem to be outputting anything:
<?php
// Make a MySQL Connection
mysql_connect("localhost", "xxxxxx", "xxxxxx") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());
// Get all the data from the "testing" table
$something= $_GET['SC'];
$where='';
switch ($something) {
case 'Stuff.php': $where= "something='Stuff'"; break;
case 'Things.php': $where= "something='Things'"; break;
}
$result= mysql_query("SELECT * FROM testing WHERE $where")
or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>Banner</th> <th>Info</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['Banner'];
echo "</td><td>";
echo $row['Info'];
echo "</td></tr>";
}
echo "</table>";
?>