I need some help understanding what I may have done wrong. I created a prepared MYSQL SELECT statement that is causing my page to display wrong. I am using a Wordpress plugin called Woody Snippets (universal snippet) - Used for inserting php, html, js & css code.
Here is the prepared MYSQL Statement:
function loadCounty(){
$sqlCounty = "SELECT id, county_name FROM wp_counties WHERE state_id=? ORDER BY county_name ASC";
$stmt = $_SESSION["link"]->prepare($sqlCounty);
$stmt->bind_param("i", $_SESSION[State]);
$stmt->execute();
$resultC = $stmt->get_result();
return $resultC;
}
Here is the PHP/javascript/HTML to display or block the section:
</body>
<?php
if($first!=""){
?>
<script type="text/javascript">
$("#firstpage").hide();
$("#secondpage").show();
$("#lastpage").hide();
</script>
<?php
}elseif($second!=""){
?>
<script type="text/javascript">
$("#firstpage").hide();
$("#secondpage").hide();
$("#lastpage").show();
</script>
<?php
}else{
?>
<script type="text/javascript">
$("#firstpage").show();
$("#secondpage").hide();
$("#lastpage").hide();
</script>
<?php
}
?>
<script type="text/javascript">
$(".chosen").chosen();
</script>
</html>
With everything in place this is how the page displays:
When I comment out 1 line of code, everything displays correctly.
Here is the commented out code:
function loadCounty(){
$sqlCounty = "SELECT id, county_name FROM wp_counties WHERE state_id=? ORDER BY county_name ASC";
$stmt = $_SESSION["link"]->prepare($sqlCounty);
$stmt->bind_param("i", $_SESSION[State]);
$stmt->execute();
// $resultC = $stmt->get_result();
return $resultC;
}
Here is the correct page display:
I would like to understand how this one change could cause this javascript to be ignored?
After a little more testing, it looks like this is a Wordpress plugin issue with Woody Snippets Universal Snippet with "$resultC = $stmt->get_result();" causing a "There has been a critical error on your website." error.