I have a php page called sample.php that calls query to databse for a few entries..
Ex. sample/apple.html sample/banana.html
If someone were to type sample/xxyxz.html it produces an error even though i have 401 redirect
$row = mysql_fetch_array($result) or die(mysql_error());

so how do i set it so if the php can't fetch the array, it goes to index.php instead?
the thing is 401 redirect only works when it's not query-related. as in example.com/xxxxxyyfad will redirect to example.com
but if someone types example.com/sample/xdfds.html, it gets an error because of the query.