Posts: 1,832
Location: Somewhere else entirely
|
The way I would do the display of the jokes, is to write a page called say, 'display.php', then you create links in this format:
link 1 goes to Joke 1
Link 2 goes to joke 3
Link 3 goes to Joke 2
becomes
<a href="display.php?joke=1>Link 1</a>
<a href="display.php?joke=3>Link 2</a>
<a href="display.php?joke=2>Link 3</a>
Then in display.php, you pull out the joke and display it:
PHP Code:
// Make database connection
$jokeid = $_GET['joke'];
$result = mysql_query("SELECT 'Jokes Text' FROM Jokes WHERE ID=$jokeid");
$text = mysql_result($result,0,'Jokes Text');
echo $text;
To use html, you can just put it into your database, although you must be careful with quotes. To make sure they behave properly use addslashes() on the string before inserting it into the db. Also be wary that if you are accepting user input (if you ever have a form where they can input their own jokes ofr example) then if you allow html you leave yourself wide open to all sorts of hijack attacks. Without being careful, people can insert javascript into your database that gets executed when the joke is displayed.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';
Please login or register to view this content. Registration is FREE (aka MSN handwriting for forums)
|