Hmmm,

I get the same error when I run

$query = "select col1 FROM Incident_Management";

It seems as though maybe it's the space?   Basically, I'm just trying to
reword the Excel query, so I'm using the part that says:

FROM Incident_Management Incident_Management

Now, I've been told that this is a Sybase DB.  Should that make a
difference?  The whole ODBC/Sybase thing is new to me.  I'm used to working
with mySQL.  


Frank Caruso-2 wrote:
> 
> I think the name of the view is just Incident_Management.
> 
> On 6/5/07, a.cook <[EMAIL PROTECTED]> wrote:
>>
>> Thanks for the reply.  I replaced the query with what you suggested, so
>> my
>> code looks something like this:
>>
>>
>> $query = "select col1, col2";
>>
>>
>> It seems as though I'm getting somewhere... now I'm getting the following
>> error:
>>
>>
>> Connection successful
>> Warning: odbc_exec() [function.odbc-exec]: SQL error: Driver]Unexpected
>> end
>> of SQL statement, SQL state 370 in SQLExecDirect in
>> C:\xampp\htdocs\odbc2.php on line 19
>>
>>
>> If I try something like:
>>
>> $query = "select col1 FROM Incident_Management Incident_Management";
>>
>> I get:
>>
>>
>> Connection successful
>> Warning: odbc_exec() [function.odbc-exec]: SQL error: Driver]Form does
>> not
>> exist on server. Incident_Management, SQL state S00 in SQLExecDirect in
>> C:\xampp\htdocs\odbc2.php on line 19
>>
>>
>> I think I'm getting really close.  Any other suggestions?
>>
>>
>>
>> Frank Caruso-2 wrote:
>> >
>> > Try taking out the "select * " and replace it with "select col1, col2"
>> and
>> > see if that works. If it does, then starting adding the columns you
>> need.
>> > My
>> > guess is one of the columns is a CLOB or BLOB and PHP does like it.
>> >
>> >
>> > On 6/4/07, a.cook <[EMAIL PROTECTED]> wrote:
>> >>
>> >> Hello,
>> >>
>> >> I have an Excel Macro that is querying an ARS db.  Everything works
>> fine.
>> >> I'm trying to port the query over to PHP on the same machine but I am
>> >> getting an error.  Here is the query from Excel:
>> >>
>> >> SELECT Incident_Management.Incident_Id,
>> >> Incident_Management.Account_Affected__,
>> >> Incident_Management.Acknowledge_Date,
>> >> Incident_Management.Affected_Item__,
>> >> Incident_Management.Assignee_Group__,
>> >> Incident_Management.Manager_On_Call,
>> >> Incident_Management.Assignee_Individual, Incident_Management.Category,
>> >> Incident_Management.Create_date, Incident_Management.Customer_Name__,
>> >> Incident_Management.Date_Time_FYI_Notification,
>> >> Incident_Management.Date_Time_Incident_Occurred,
>> >> Incident_Management.Date_Time_Outage_Began__,
>> >> Incident_Management.Date_Time_Outage_Ended__,
>> >> Incident_Management.Division,
>> >> Incident_Management.Facility,
>> >> Incident_Management.Facility_Location_Affected,
>> >> Incident_Management.Hold_Hours,
>> Incident_Management.Incident_Description,
>> >> Incident_Management.Incident_Id___Parent,
>> >> Incident_Management.Exclude_from_Reporting_,
>> >> Incident_Management.Modified_date, Incident_Management.Open_Hours,
>> >> Incident_Management.Outage_Duration,
>> >> Incident_Management.Problem_Id___Parent,
>> >> Incident_Management.Reported_Outage,
>> >> Incident_Management.Resolution_Summary,
>> >> Incident_Management.Exclusion_Reason, Incident_Management.SLA_FIX,
>> >> Incident_Management.SLA_UPDATE, Incident_Management.Severity,
>> >> Incident_Management.Status,
>> >> Incident_Management.Status_History_Closed_TIME,
>> >> Incident_Management."Status_History_Service Restored_TIME",
>> >> Incident_Management.Total_Duration__in_Hours_,
>> Incident_Management.Type,
>> >> Incident_Management.Configured_Item_Name__,
>> >> Incident_Management.D_T_Sev_Upgraded,
>> Incident_Management.Suspend_Hours,
>> >> Incident_Management.Initial_Customer_Contact,
>> >> Incident_Management.Notification_Text,
>> >> Incident_Management.Customer_Contacted
>> >>
>> >> FROM Incident_Management Incident_Management
>> >>
>> >> WHERE (Incident_Management.Severity='One') AND
>> >> (Incident_Management.Account_Affected__='My Company') AND
>> >> (Incident_Management.Status<>'Closed' And
>> >> Incident_Management.Status<>'Service Restored') OR
>> >> (Incident_Management.Severity='Two') AND
>> >> (Incident_Management.Account_Affected__='My Company') AND
>> >> (Incident_Management.Status<>'Closed' And
>> >> Incident_Management.Status<>'Service Restored')
>> >>
>> >> ORDER BY Incident_Management.Configured_Item_Name__
>> >>
>> >>
>> >> I am able to connect to the DB via PHP but get an error when running
>> the
>> >> same query.  Is there something I need to do to rewrite this code so
>> it
>> >> will
>> >> work in PHP?  Is there a simple query I can run to make sure it is
>> >> working
>> >> correctly?  I tried to run a simple script such as:
>> >>
>> >>
>> >> <?php
>> >>
>> >> $db_user = "My Username";
>> >> $db_pass = "My Password";
>> >> $dsn = "OPASRPT";
>> >>
>> >> $conn = odbc_connect($dsn, $db_user, $db_pass);
>> >>
>> >> if ($conn <= 0) {
>> >>         echo "Error in connection<BR>";
>> >>         exit;
>> >>         }
>> >> else {
>> >>         echo "<P>Connection successful\n";
>> >>         };
>> >>
>> >> $query = "SELECT * FROM 'Incident_Management Incident Management'";
>> >>
>> >> $result = odbc_Exec($conn, $query);
>> >>
>> >> odbc_close($conn);
>> >> ?>
>> >>
>> >>
>> >>
>> >> And when I run the script, here is what I get:
>> >>
>> >>
>> >> Connection successful
>> >> Warning: odbc_exec() [function.odbc-exec]: SQL error: Driver]Expected
>> >> lexical element not found: (, SQL state 370 in SQLExecDirect in
>> >> C:\xampp\htdocs\odbc2.php on line 19
>> >>
>> >>
>> >> Does anyone have any suggestions?  Thank you.
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/converting-excel-ARS-query-to-php-tf3867834.html#a10958050
>> >> Sent from the ARS (Action Request System) mailing list archive at
>> >> Nabble.com.
>> >>
>> >>
>> >>
>> _______________________________________________________________________________
>> >> UNSUBSCRIBE or access ARSlist Archives at
>> www.arslist.orgARSlist:"Where
>> >> the Answers Are"
>> >>
>> >
>> >
>> >
>> > --
>> > Frank Caruso
>> > Specific Integration, Inc.
>> > Senior Remedy Engineer, ITIL Foundation Certified
>> > www.specificintegration.com
>> > 703-376-1249
>> >
>> >
>> _______________________________________________________________________________
>> > UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
>> ARSlist:"Where
>> > the Answers Are"
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/converting-excel-ARS-query-to-php-tf3867834.html#a10969236
>> Sent from the ARS (Action Request System) mailing list archive at
>> Nabble.com.
>>
>>
>> _______________________________________________________________________________
>> UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where
>> the Answers Are"
>>
> 
> 
> 
> -- 
> Frank Caruso
> Specific Integration, Inc.
> Senior Remedy Engineer, ITIL Foundation Certified
> www.specificintegration.com
> 703-376-1249
> 
> _______________________________________________________________________________
> UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where
> the Answers Are"
> 
> 

-- 
View this message in context: 
http://www.nabble.com/converting-excel-ARS-query-to-php-tf3867834.html#a10969632
Sent from the ARS (Action Request System) mailing list archive at Nabble.com.

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where the 
Answers Are"

Reply via email to