I'm Trying To Make My Site Automated By Using PHP So Far I Have A Piece Of Code Which Prints All Of The Jokes Onto One Page. But Using Query Strings I Want To Display Different Categories Of Jokes On Just One Page.
eg. jokes.php?cat=general
would show all the general jokes in the database
i have constructed this code. but it keeps sending back the same jokes 🙁
<?php
// Request the text of all the jokes
$result = mysql_query("SELECT id,type,JokeText FROM Jokes WHERE type =
// $cat = what category jokes it should print
'$cat' ORDER BY id ASC");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
exit(); }
// Display the text of each joke in a paragraph
while ( $row = mysql_fetch_array($result) ) {
echo("<P>" . $row["JokeText"] . "</P>"); }
echo "<br>";
include ("includes/footer.php");
?>
Please could somebody help me
I would be very thankfull!! and you will get credit on my site! 🙂
i would like to note that the use of
<?
$link = $_GET['x'];
include "$link";
?>
doesn't help my case, because i want to use databases to run it off. thanks 🙂