conditional statement for php query to oracle

I'm very new to PHP, I'm really more familiar with Coldfusion, but I find myself needing to do something quick in php. So I have a query in PHP, connecting to an Oracle database...no problem with the connection or the initial query, but when I put a where statement in, things stop working....so I know I'm doing something wrong. The following query works fine:

$query = 'SELECT * FROM SCHEME.INSTALLATION';

But this statement does not:

$query = 'SELECT * FROM SCHEME.INSTALLATION WHERE INSTALLATION.NUMBER = '12345'';

Can anyone shed some light on what I'm doing wrong??? Thansk Alot!!!
diecasthftAsked:
Who is Participating?
 
Terry WoodsIT GuruCommented:
That's because you have single quotes within single quotes - the alternative is to escape them, like this:
$query = 'SELECT * FROM SCHEME.INSTALLATION WHERE INSTALLATION.NUMBER = \'12345\'';

Open in new window

0
 
Terry WoodsIT GuruCommented:
Try:
$query = "SELECT * FROM SCHEME.INSTALLATION WHERE INSTALLATION.NUMBER = '12345'";

Open in new window

0
 
diecasthftAuthor Commented:
And that does the trick....Thanks so much for your help!!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.