Page 1 of 1

SQL Issue

Posted: Fri Dec 11, 2009 9:08 pm
by v8killah
Hi,

My PHP page is connecting to an Oracle db, in which I've created the following query with the SQL builder. This is a direct paste out of Oracle and I'm pretty sure the quotation marks are causing the issue. Does anyone know what I need to do to get it to work with PHP? I've tried removing the quotes, changing them to single, etc. Thanks!

Code: Select all

select     "EMPLOYEES"."EMPLOYEE_ID" as "EMPLOYEE_ID",
     "EMPLOYEES"."LAST_NAME" as "LAST_NAME",
     "EMPLOYEES"."FIRST_NAME" as "FIRST_NAME",
     "EMPLOYEES"."EMAIL" as "EMAIL",
     "EMPLOYEES"."LOCATION_ID" as "LOCATION_ID",
     "EMPLOYEES"."CATEGORY_ID" as "CATEGORY_ID",
     "EMPLOYEES"."TITLE" as "TITLE",
     "EMPLOYEES"."SALARY" as "SALARY",
     "EMPLOYEES"."COMMISION" as "COMMISION",
     "ADDRESS"."LINE_1" as "LINE_1",
     "ADDRESS"."LINE_2" as "LINE_2",
     "ADDRESS"."LINE_3" as "LINE_3",
     "ADDRESS"."CITY" as "CITY",
     "ADDRESS"."STATE" as "STATE",
     "ADDRESS"."ZIP" as "ZIP",
     "CONTACT_NUMBER"."MEDIUM" as "MEDIUM",
     "CONTACT_NUMBER"."AREA_CODE" as "AREA_CODE",
     "CONTACT_NUMBER"."EXCHANGE" as "EXCHANGE",
     "CONTACT_NUMBER"."CONTACT_NUMBER" as "CONTACT_NUMBER"
 from     "CONTACT_NUMBER" "CONTACT_NUMBER",
     "ADDRESS" "ADDRESS",
     "EMPLOYEES" "EMPLOYEES"
 where   "EMPLOYEES"."EMPLOYEE_ID"="ADDRESS"."OWNER_ID"
 and     "ADDRESS"."OWNER_ID"="CONTACT_NUMBER"."OWNER_ID"
  and      "CONTACT_NUMBER"."TYPE" ='employee'
   and     "ADDRESS"."TYPE" ='employee'

Re: SQL Issue

Posted: Sat Dec 12, 2009 4:18 am
by Rakward
in phpcode, a query would be something like

$result = mysql_query("SELECT field1, field2 FROM database")

" to begin the querytext and to end it. since this is basically just a string. you can also use a $var in the text or even as the entire query itself.

So remove all "" and put the entire sqltext between "".

Hope this helps.

Re: SQL Issue

Posted: Sun Dec 13, 2009 5:29 pm
by v8killah
Thank you. That worked.