File "setslugUrl.php"

Full Path: /home/krishnamexports/public_html/panel/global_assets/js/setslugUrl.php
File size: 518 bytes
MIME-type: text/x-php; charset=us-ascii
Charset: utf-8

<?php

error_reporting(0);

include("../../config/database.php");

$name      = $_GET['name'];

$tableName = $_GET['tableName']; 

if(!empty($name))

{

	$slug = preg_replace("/-$/","",preg_replace('/[^a-z0-9]+/i', "-", strtolower($name)));

	$query = "SELECT COUNT(*) AS NumHits FROM $tableName WHERE  slug_url  LIKE '$slug%'";

	$result = mysqli_query($cn, $query);

	$row    = mysqli_fetch_array($result);

	$numHits = $row['NumHits'];

	echo  ($numHits > 0) ? ($slug . '-' . $numHits) : $slug;

}

?>