50) $error = "Maximum name length is 50 characters."; elseif(strlen($comment) == 0) $error = "Please enter your comments."; elseif(strlen($comment) > 500) $error = "Maximum comment length is 500 characters."; elseif($_SESSION["captcha"] != $_POST['captcha']) $error = "Your confirmation text does not match, only enter the black characters."; echo "The error was: " .$error; if(strlen($error) == 0) { $ip = $REMOTE_ADDR; $insert_comment = mysqli_query($con,"INSERT INTO comments (name, comment, recipeid, dateadded, userip) VALUES ('".mysqli_real_escape_string ($con,$yourname)."', '".mysqli_real_escape_string($con,$comment)."', ".$id.", NOW(), '".mysqli_real_escape_string($con,$ip)."')"); echo "MYSQL QUERY = " . "INSERT INTO comments (name, comment, recipeid, dateadded, userip) VALUES ('".mysqli_real_escape_string($con,$yourname)."', '".mysqli_real_escape_string($con,$comment)."', ".$id.", NOW(), '".mysqli_real_escape_string($con,$ip)."')"; $hideform = TRUE; if(strlen($vote) > 0) { $lookup_field = "votestar".$vote; $get_values = mysqli_query($con,"SELECT votestar1, votestar2, votestar3, votestar4, votestar5 FROM recipes WHERE id = ".$id." LIMIT 1"); while($row = mysqli_fetch_assoc($get_values)){ $votestar1 = $row['votestar1']; $votestar2 = $row['votestar2']; $votestar3 = $row['votestar3']; $votestar4 = $row['votestar4']; // $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 = mysqli_query($con,"UPDATE recipes SET ".$lookup_field." = ".$$lookup_field.", votestartotal = ".$total." WHERE id = ".$id." LIMIT 1"); } } } } $temp = mysqli_query($con,"SELECT * FROM recipes WHERE id = ".$id." LIMIT 1"); while($row = mysqli_fetch_assoc($temp)){ $title = ucwords($row['title']); $category = $row['category']; $subcategory = $row['category2']; $recipe = $row['recipe']; $recipe = trim(str_replace(array("

", "

"), "", $recipe)); $votestartotal = $row['votestartotal']; $image = $row['image']; $imgview = $row['imgview']; } // $title = UCWords(mysql_result($temp, 0, title)); // $category = mysql_result($temp, 0, category); // $subcategory = mysql_result($temp, 0, category2); // $recipe = mysql_result($temp, 0, recipe); // $recipe = trim(str_replace(array("

", "

"), "", $recipe)); // $votestartotal = mysql_result($temp, 0, votestartotal); $ptitle = "Recipe for ".$title; $pkeys = $title." Recipe"; $pdesc = $title." Recipe"; // get comments // $get_comments = mysqli_query($con,"SELECT name, comment, recipeid, dateadded, userip FROM comments WHERE recipeid = ".$id." ORDER BY dateadded DESC"); include_once("header_view.php"); include_once("header.php"); $dir = "./assets/uploads/".$image; ?>
0) echo UCWords($category); ?>

0) echo "
ERROR: ".$error."

"; ?>