ERROR!
No joke was requested, please go back to the homepage and start again.
";
}
else {
$vote = $_REQUEST['vote'];
if($vote) {
$lookup_field = "votestar".$vote;
$get_values = mysql_query("SELECT votestar1, votestar2, votestar3, votestar4, votestar5 FROM jokes WHERE id = ".$j." LIMIT 1");
$votestar1 = mysql_result($get_values, 0, votestar1);
$votestar2 = mysql_result($get_values, 0, votestar2);
$votestar3 = mysql_result($get_values, 0, votestar3);
$votestar4 = mysql_result($get_values, 0, votestar4);
$votestar5 = mysql_result($get_values, 0, votestar5);
if($vote == 1) $votestar1 = $votestar1+1;
elseif($vote == 2) $votestar2 = $votestar2+1;
elseif($vote == 3) $votestar3 = $votestar3+1;
elseif($vote == 4) $votestar4 = $votestar4+1;
elseif($vote == 5) $votestar5 = $votestar5+1;
$total = ($votestar1 * 1)+($votestar2 * 2)+($votestar3 * 3)+($votestar4 * 4)+($votestar5 * 5);
$total = $total/($votestar1+$votestar2+$votestar3+$votestar4+$votestar5);
$update_joke = mysql_query("UPDATE jokes SET ".$lookup_field." = ".$$lookup_field.", votestartotal = ".$total." WHERE id = ".$j." LIMIT 1");
}
$jokeqry = mysql_query("SELECT * FROM jokes WHERE id = ".$j." LIMIT 1");
if($jokeqry) {
$category = mysql_result($jokeqry, 0, category);
$joke = stripslashes(mysql_result($jokeqry, 0, joke));
$dateadded = mysql_result($jokeqry, 0, dateadded);
$dateadded = substr($dateadded, 8, 2)."/".substr($dateadded, 5, 2)."/".substr($dateadded, 0, 4);
$votestartotal = mysql_result($jokeqry, 0, votestartotal);
$views = mysql_result($jokeqry, 0, views);
$newviews = $views+1;
$update = mysql_query("UPDATE jokes SET views = ".$newviews." WHERE id = ".$j." LIMIT 1");
}
else die("ERROR LOOKING UP JOKE");
$ptitle = substr($joke, 0, 50)."... joke";
$meta_keys = str_replace(" ", ", ", substr($joke, 0, 50)).", search, jokes, funny, laugher, joke, gag, laughing";
$meta_desc = substr($joke, 0, 50)."... joke";
if($r == 1) $selected = "RANDOM";
else $selected = "VIEW";
include("header.php");
?>
"; echo " | |
";
if($r == 1) echo "Random";
else echo "Viewing";
echo " Joke: | |
Category: | ".$category." |
Date Added: | ".$dateadded." |
Views: | ".$newviews." |
Joke: | ".$joke." |
Add to del.icio.us Digg this Reddit |