If the id doesn't exist how to redirect to id=1?

General discussions related to php

Moderators: macek, egami, gesf

Post Reply
User avatar
TomCornar
New php-forum User
New php-forum User
Posts: 25
Joined: Fri Sep 14, 2012 12:06 am

Re: If the id doesn't exist how to redirect to id=1?

Post by TomCornar » Sun Sep 16, 2012 11:21 pm

SELECT COUNT(*) as count FROM demotivators WHERE id = '$id'

$count=mysql_fetch_assoc($result);
$count=$count['count'];
If($count >0)
{
/*Your functionality*/
}
else
{
/* redirect */
}
hope this helps.
Regards,
Tom Cornar
Trinay Technology Solutions
http://www.trinay.com

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest