![]() |
| The AccuTerm forum has moved. Go to community.rocketsoftware.com to register for the new Rocket forum. |
|
Post Reply
|
| Author | |
Tachikoma805
Newbie
Joined: May 15 2009 Location: United States Status: Offline Points: 4 |
Post Options
Thanks(0)
Quote Reply
Topic: PHP ODBC connectingPosted: February 12 2010 at 7:07am |
|
Hello,
Our DBA has made some table views available for ODBC, and using the DSN for D3/pick, I can connect to them in UPS Worldship just fine, for what I need. In the past, I used a lightweight client to view this data, again using the same DSN, and it has worked out well, letting me browse the table data. So, now I want to make some of this data available on a Intranet page, for notifications (ex: open orders). I have a simple PHP script that runs and connects using the DSN, and based on the error I get, it looks like it connects alright, but I am somehow missing the proper commands? Here is what I get when I run this: Warning: odbc_exec() [function.odbc-exec]: SQL error: [Raining Data][ODBC D3 Driver]Syntax error, SQL state 37000 in SQLExecDirect in C:\wamp\www\components\com_jumi\jumi.php(25) : eval()'d code on line 9 Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in C:\wamp\www\components\com_jumi\jumi.php(25) : eval()'d code on line 12 Hi, I'm running! And here is my script: <?PHP $connect = odbc_connect("FORESITE_VIEW", "KEY", ""); $query = "SELECT ORDER_NO, SHIPTO_NAME FROM KEY.ORDERINFO"; $result = odbc_exec($connect, $query); while(odbc_fetch_row($result)){ $ORDER_NO = odbc_result($result, 1); $SHIPTO_NAME = odbc_result($result, 2); print("$ORDER_NO $SHIPTO_NAME"); } print "Hi, I'm running!"; odbc_close($connect); ?> I know my server is ok, as the PHP prints "Hi, I'm running!", but as to the error... I am at a loss? Any insight? Thanks, Tachi |
|
|
First toil, then the grave
|
|
![]() |
|
mlucas67
Senior Member
Joined: February 12 2007 Location: United States Status: Offline Points: 103 |
Post Options
Thanks(0)
Quote Reply
Posted: April 08 2010 at 6:53am |
|
I believe you have to have ; at the end of the sql statement (and the php code line). See code...
|
|
![]() |
|
Tachikoma805
Newbie
Joined: May 15 2009 Location: United States Status: Offline Points: 4 |
Post Options
Thanks(0)
Quote Reply
Posted: April 08 2010 at 7:04am |
|
Hmm, I used your code, but I get the same error:
Warning: odbc_exec() [function.odbc-exec]: SQL error: [Raining Data][ODBC D3 Driver]Syntax error, SQL state 37000 in SQLExecDirect in C:\wamp\www\components\com_jumi\jumi.php(25) : eval()'d code on line 4 Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in C:\wamp\www\components\com_jumi\jumi.php(25) : eval()'d code on line 5 Hi, I'm running! |
|
|
First toil, then the grave
|
|
![]() |
|
Tachikoma805
Newbie
Joined: May 15 2009 Location: United States Status: Offline Points: 4 |
Post Options
Thanks(0)
Quote Reply
Posted: April 08 2010 at 7:05am |
|
Confusing thing though... I am not connecting to a SQL table, its ODBC to a D3 table view...
|
|
|
First toil, then the grave
|
|
![]() |
|
mlucas67
Senior Member
Joined: February 12 2007 Location: United States Status: Offline Points: 103 |
Post Options
Thanks(0)
Quote Reply
Posted: April 08 2010 at 7:10am |
|
Well, now, that's the funny part...D3 ODBC presents itself as SQL which is why you send a SQL query to it and not a D3 Access query.
You might try posting to comp.databases.pick on Google Groups. This in not strictly an AccuTerm question but a D3 ODBC question.
Thanks,
Marshall
|
|
![]() |
|
Tachikoma805
Newbie
Joined: May 15 2009 Location: United States Status: Offline Points: 4 |
Post Options
Thanks(0)
Quote Reply
Posted: April 08 2010 at 7:14am |
|
Thanks Marshall, I'll head over to Google... If i find the solution though, I'll at least post a link to it here... this is driving me batty.
Again, thanks! |
|
|
First toil, then the grave
|
|
![]() |
|
mlucas67
Senior Member
Joined: February 12 2007 Location: United States Status: Offline Points: 103 |
Post Options
Thanks(0)
Quote Reply
Posted: April 08 2010 at 7:16am |
|
Been there, wish I could help more, thought I had with the ; since that has bit me before. Good luck!
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |