I am including some files. basicly the file included is determined by ?cid=number
then number.dat is included
however if 12 or higher is entered for cid i want a message saying no category exists instead of getting an error. How do i do that?try:
if($_GET['cid'] < 12)
{
echo 'no category';
}
else
{
include("$_GET['cid].dat");
}almost...
$cid = $_GET["cid"];
if($cid < 12 && $cid >= 0 && is_numeric($cid))
{
include("$cid.dat");
}
else
{
echo "ERROR: No such category exists.";
}
this might work better, presuming there is no negative category index.yeah...your version is more complete ...I just did up the other one to show him how...You also got the if($_GET['cid'] < 12) wrong true...
hense me putting try: not this is how it is: tis not good to write php when you apparently just wrote what wouldeve been a fanfic into a inappropiate story thats rated 18+...
then number.dat is included
however if 12 or higher is entered for cid i want a message saying no category exists instead of getting an error. How do i do that?try:
if($_GET['cid'] < 12)
{
echo 'no category';
}
else
{
include("$_GET['cid].dat");
}almost...
$cid = $_GET["cid"];
if($cid < 12 && $cid >= 0 && is_numeric($cid))
{
include("$cid.dat");
}
else
{
echo "ERROR: No such category exists.";
}
this might work better, presuming there is no negative category index.yeah...your version is more complete ...I just did up the other one to show him how...You also got the if($_GET['cid'] < 12) wrong true...
hense me putting try: not this is how it is: tis not good to write php when you apparently just wrote what wouldeve been a fanfic into a inappropiate story thats rated 18+...