Jump to content

switch/case and sql query


cdinca

Recommended Posts

I can't get the switch case value into my sql query...don't get why.

 

if($_GET['showme']){
$whichdoc=$_GET['showme'];
} else {
$whichdoc="firstdoc";
}
switch ($whichdoc){
case "firstdoc":
$myquery="SELECT blah blah blah";
break;

case "seconddoc":
$myquery="SELECT blah blah blah";
break;

 

this always ends up giving an empty query. However if I make my first line

 

$whichdoc="firstdoc";

 

I think this must have something to do with execution order, but I don't know what is going on.

 

Help Please :)

 

 

Link to comment
https://forums.phpfreaks.com/topic/192663-switchcase-and-sql-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.