File "sCategory.php"

Full Path: /home/krishnamexports/public_html/panel/pages/sub_category/sCategory.php
File size: 899 bytes
MIME-type: text/x-php; charset=us-ascii
Charset: utf-8

<?php include("../../../config/database.php");?>

<?php

$loop=0;

$sqlSubCategory 	= mysqli_query($cn,"select * from tbl_product");

while($sqlSubCategoryData = mysqli_fetch_array($sqlSubCategory))

{		

	$slug_url		    = mysqli_real_escape_string($cn,$sqlSubCategoryData['product']);

	$slug_url			= str_replace(" ","-",$slug_url);

	$slug_url			= strtolower($slug_url);

	

	$sqlSlug 	= mysqli_query($cn,"select * from tbl_product where slug_url='".$slug_url."%'");

	if(mysqli_num_rows($sqlSlug)>0)

	{

		$slug_url			= $slug_url."-".mysqli_num_rows($sqlSlug)+1;

		$sqlSubject = mysqli_query ($cn,"update tbl_product SET slug_url='$slug_url' where `id`='".$sqlSubCategoryData['id']."'"); 

	}

	else

	{

		$sqlSubject = mysqli_query ($cn,"update tbl_product SET slug_url='$slug_url' where `id`='".$sqlSubCategoryData['id']."'");

	}

	$loop++;	

}

echo $loop;

?>