02-17-2010, 10:35 AM
|
#1 (permalink)
|
|
The Contributor
Join Date: Sep 2007
Location: Finland
Posts: 45
Thanks: 3
|
If duplicate title, add rand else, do nothing??
Hi all!
Basic stuff, maybe but I jsut can't figure it out? Can someone help me here?
If duplicate title, add rand numbers, if not duplicate title then do nothing. That's easy but when I need to check if that modifyed title isn't also duplicate I hit the wall..
Here's code (codeigniter):
Code:
$title = $this->input->post('title');
if(this->db->where('title', $title)->get('posts'))
{
$rand = rand(1000, 9000);
$title = $title . '-' . $rand;
}
Thanks for all help!
|
|
|