There def one error, and its to do with passing the value of the search into this select statement and using it as LIKE ā%$in$ā, its fine being used in the first select statement which is showing the first nice.
if(isset($_GET['txt'])){$in=$_GET['txt'];}else{$in='';}
$query="select Nom_Hot, IdType_Hot, Id_Hot, IdRsrt_Hot, Dir_Hot, IdCat_Hot, Act_Hot, Foto1_Hot from tbl_hotels LEFT JOIN tbl_resorts ON (tbl_resorts.Id_Rsrt=tbl_hotels.IdRsrt_Hot) where tbl_resorts.Nom_Rsrt like '%$in%' AND Act_Hot=1 LIMIT 9";
which is coming from the ajax below and the form
<input type="radio" name="rdio" value="region" checked onclick="clear_form_elements(this.form)" class="radio-buttons" data-hint="eg. Cancun, Barcelona, London, Phuket..." ><label>City or Region</label>
if ($("input[name='rdio']:checked").val() == 'region')
genderValue= "region"
var url="ajax-search-demock_3.php";
url=url+"?txt="+str+"";
url=url+"&radio="+genderValue;
url=url+"&sid="+Math.random();
httpxml.onreadystatechange=stateChanged;
httpxml.open("GET",url,true);
httpxml.send(null);
document.getElementById("msg").innerHTML="Please Wait ...";
document.getElementById("msg").style.display='inline';
document.getElementById("displayDiv").style.display='block';
So when I then click the āSHOW MOREā button
<div class="show_more_main" id="show_more_main<?php echo $tutorial_id; ?> ">
<span id="<?php echo $tutorial_id; ?>" class="show_more" title="Load more posts">Show more</span>
<span class="loding" style="display: none;"><span class="loding_txt">Loading....</span></span>
This ajax script comes into action
$(document).ready(function(){
$(document).on('click','.show_more',function(){
var ID = $(this).attr('id');
$('.show_more').hide();
$('.loding').show();
$.ajax({
type:'POST',
url:'ajax-search-demock_3.php',
data:'id='+ID,
success:function(html){
$('#show_more_main'+ID).remove();
$('.tutorial_list').append(html);
}
});
});
});
Which then gets picked up the section of code im working on to show the next load of hotels after show more but the value of $in isnt being passed over
if(isset($_POST["id"]) && !empty($_POST["id"])){
$msg="";
$sqlAll="select COUNT(*) as num_rows from tbl_hotels LEFT JOIN tbl_resorts ON (tbl_resorts.Id_Rsrt=tbl_hotels.IdRsrt_Hot) where tbl_resorts.Nom_Rsrt like '%$in%' AND Act_Hot=1 WHERE tbl_hotels.Id_Hot < ".$_POST['id']." ORDER BY tbl_hotels.Id_Hot DESC";
$stmt = $dbo->prepare($sqlAll);
$num_rows = $stmt->fetchColumn();
echo $num_rows."happy";
and the echo is empty but for the word happy, which im not lol.
This is mind bending, wish I could send you the two files as its hard to explain by type