Jump to content


Photo

I'm sure this is a very easily fixed problem, echoing contents of a variable


  • Please log in to reply
1 reply to this topic

#1 DaveLinger

DaveLinger
  • Members
  • PipPipPip
  • Advanced Member
  • 268 posts
  • LocationWV, USA

Posted 31 July 2006 - 03:50 AM

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;
}

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!
http://www.DaveLinger.com
dave at linger dot com

#2 Drumminxx

Drumminxx
  • Members
  • PipPipPip
  • Advanced Member
  • 92 posts
  • LocationUSA

Posted 31 July 2006 - 04:08 AM

try flipping your quotes around, that should do it

default:
    $sqlthing = "WHERE newsecid= '$pid'";
    break;

remember everything inside single quotes gets printed/expressed as is
:: gucci.com ::
:: blockbuster.com ::

--------------------




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users