Switch to or not?
From: Samuël van Laere (fortjeREM_at_chello.nl)
Date: 11/30/04
- Next message: Harrie Verveer: "Re: backslashes added to quotes when reading from form"
- Previous message: Jan K.: "Re: using UTC_offset from Date"
- Next in thread: Oli Filth: "Re: Switch to or not?"
- Reply: Oli Filth: "Re: Switch to or not?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Nov 2004 19:04:11 GMT
Ok below you'll see two snippets that will do the same.
Is there any reason to pick one over the other?
If so what would be the reason?
Regards,
Samuël van Laere
the Netherlands
if ($pathinfo[1] == 'pagina') {
$query = "SELECT inhoud, titel FROM documenten WHERE id = $id";
}
if ($pathinfo[1] == 'artikel') {
$query = "SELECT inhoud, titel FROM artikel WHERE id = $id";
}else {
$query = "SELECT inhoud, titel FROM documenten WHERE id = 1";
}
switch ($pathinfo[1]) {
case 'pagina': $query = "SELECT inhoud, titel FROM documenten WHERE
id = $id";
break;
case 'artikel': $query = "SELECT inhoud, titel FROM artikel WHERE id
= $id";
break;
default: $query = "SELECT inhoud, titel FROM documenten WHERE id =
1";
break;
}
- Next message: Harrie Verveer: "Re: backslashes added to quotes when reading from form"
- Previous message: Jan K.: "Re: using UTC_offset from Date"
- Next in thread: Oli Filth: "Re: Switch to or not?"
- Reply: Oli Filth: "Re: Switch to or not?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|