DaveLinger Posted July 31, 2006 Share Posted July 31, 2006 [code]switch ($pid){ case 12: $sqlthing = 'WHERE newsecid IN (12,34,35,36,37,38,40,41,42,43,45,46,48)'; break; case 13: $sqlthing = 'WHERE newsecid IN (13,35,36,37,39,40,41,42,43,44,45,46,47)'; break; case 14: $sqlthing = 'WHERE newsecid IN (14,34,35,36,37)'; break; case 20: $sqlthing = 'WHERE newsecid IN (20,38,39,40,41,44,45,47)'; break; case 32: $sqlthing = 'WHERE newsecid IN (32,41,42,44,45,47)'; break; case 16: $sqlthing = 'WHERE newsecid IN (16,48)'; break; default: $sqlthing = 'WHERE newsecid= "$pid"'; break;}[/code]if the $pid is none of the "case"s, I get an SQL error which says the query is WHERE newsecid=$pid , when $pid SHOULD be the number! Link to comment https://forums.phpfreaks.com/topic/16071-im-sure-this-is-a-very-easily-fixed-problem-echoing-contents-of-a-variable/ Share on other sites More sharing options...
Drumminxx Posted July 31, 2006 Share Posted July 31, 2006 try flipping your quotes around, that should do itdefault: $sqlthing = "WHERE newsecid= '$pid'"; break;remember everything inside single quotes gets printed/expressed as is Link to comment https://forums.phpfreaks.com/topic/16071-im-sure-this-is-a-very-easily-fixed-problem-echoing-contents-of-a-variable/#findComment-66217 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.