<?php
	session_start();
	include_once('../../../db/saucerer.php');

	if(isset($_GET['id'])){

	$a="'";
    $b="";
    $title1 = str_replace($a, $b, strtolower($_GET['title']));

	$x=" ";
    $y="-";
    $url = str_replace($x, $y, $title1);


		$sql = "UPDATE listings SET url = '$url' WHERE id = '".$_GET['id']."'";

		//use for MySQLi OOP
		if($conn->query($sql)){
			$_SESSION['success'] = 'Succesful';
		}
		
		else{
			$_SESSION['error'] = 'Failed!';
		}
	}

	header('location: ../?creator=1&#nav_'.$_GET['id'].'');
?>