Quote:
Originally Posted by zijlstravideo
Lol, it's always those small things that mess things up. I once wasted an entire day because I had a white space in the $dbpass = "pass "; 
By the way, I think you can even shorten this:
$id=0;
if ( ! isset($_GET['id'] ) )
{
header('Location: index.php');
}
else
{
$id=intval($_GET['id']);
}
if($id==0)
{
die('bad id passed in');
}
Into:
$id=intval($_GET['id']);
if($id==0)
{
header( "Location: index.php" ); //or any other page like 404
exit;
}
As intval will also output 0 if $id is empty.
|
Yep, that would work.
I tend to, when trying to do code 101 stuff use old old school. First step intialize variable to default value then use it.
But yeah you are initializing it to whatever comes into the get if it is a valid int or zero if not so it does the same thing in a couple of less words.
.