Posts

first li active in while loop in php mysql

<?php   $sql="SELECT * from `shiksha_testimonial` where featured=1 order by testimonial_id DESC";    $result=mysqli_query($con,$sql);    $num_rows=mysqli_num_rows($result);    if($num_rows > 0)    {    $i=0;   while($row=mysqli_fetch_array($result))                     {                    ?>                <div class="item carousel-item <?php if($i==0) {      $i=1;      echo 'active'; } ?>">                 <div class="img-box"><img src="<?php echo $base_url ?>/uploads/testimonial/<?php echo $row['client_img']; ?>" alt=""></div>                 <p class="testimonial"><?php echo mb...

create unique slug in php mysql

$slug = ''; $slug = preg_replace('/[^a-z0-9]+/i', '-', trim(strtolower($_POST["business_title"])));  $query = "SELECT `listing_slug` FROM `listing` WHERE listing_slug LIKE '$slug%'";   $slug_result=mysqli_query($con,$query);   $slug_num=mysqli_num_rows($slug_result);   if($slug_num > 0)   {  while ($row = mysqli_fetch_assoc($slug_result)) {      $data[] = $row['listing_slug'];     } if(in_array($slug, $data))    {     $count = 0;     while( in_array( ($slug . '-' . ++$count ), $data) );     $slug = $slug . '-' . $count;    }   }

php logical programs

https://www.letsknowit.com/php-programming-questions

search page with pagination in php

<?php ob_start(); include_once('common/header.php'); $search='';    $search=$_REQUEST['search']; $category=$_REQUEST['category']; $location=$_REQUEST['location']; ?>   <!----main-info--->   <section id="food-category">     <div class="block remove-top">       <div class="container m-sis-back">         <div class="row">           <div class="col-lg-3">             <div class="adds"> <a href="#"><img src="ap-img/about-stud.png" class="img-responsive"></a> </div>           </div>           <div class="col-lg-9">             <div class="ml-placessec godouble golist">               <div class="row">   <?php $perpage = 2; if(isset($_G...

search with multiple fields in php

<?php   include_once('common/header.php'); $search='';    $search=$_REQUEST['search']; $category=$_REQUEST['category']; $location=$_REQUEST['location']; //$sql1="SELECT `listing`.*, listing_category.cat_id, listing_category.categoryslug from `listing` left join listing_category on listing.category_id=listing_category.cat_id WHERE listing.listing_title LIKE '%".$search."%' AND listing_category.categoryslug LIKE '%".$category."%' AND listing.business_address LIKE '%".$location."%' order by listing.date_added DESC"; $sql1="SELECT `listing`.*, listing_category.cat_id, listing_category.categoryslug from `listing` left join listing_category on listing.category_id=listing_category.cat_id WHERE listing.listing_title LIKE '%".$search."%' AND listing_category.categoryslug LIKE '%".$category."%' AND (listing.business_address LIKE '%...

url rewrite for dynamic category page using htaccess

http://shikshaadhar.com/category.php?category=institutes to http://shikshaadhar.com/colleges.html Sample code below: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^([^/]*)\.html$ /category.php?category=$1 [L] </IfModule>

blog with source code in ci

https://bitbucket.org/richardwo/coding-test-blog-ci/src/39eaf781c512507fd87452100a9f38bb656e3635?at=master