PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 30th, 2013, 03:30 PM
handro1104 handro1104 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Posts: 10 handro1104 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 21 m 21 sec
Reputation Power: 0
PHP-DB - Problems with DB2

I only have two months with PHP. I am trying to access a DB database with ODBC but I have a problem and haven't found the solution in the Internet. My code is:

Code:
$dbconn = odbc_connect("xxx", "xxx", "xxx");
$statement = odbc_prepare ($dbconn, $sql);
$result = odbc_exec($dbconn, $statement);

I get the connection and the statement, but I get an exception getting the result.

If you can give me code to execute a select statement, that would help me too. I haven't been able to do it with what i have searched and i settled for ODBC>

Your help would be greatly appreciated.

Reply With Quote
  #2  
Old January 30th, 2013, 03:48 PM
handro1104 handro1104 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Posts: 10 handro1104 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 21 m 21 sec
Reputation Power: 0
Another way it fails

[QUOTE=handro1104]I only have two months with PHP. I am This code fails too:

Code:
$dbconn = odbc_connect("xxx", "xxx", "xxx");
$result = odbc_exec($dbconn, $sql);

The sql works fine with DbVisualizer.

Reply With Quote
  #3  
Old January 30th, 2013, 04:02 PM
handro1104 handro1104 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Posts: 10 handro1104 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 21 m 21 sec
Reputation Power: 0
The actual problem is that I am getting false for $result.

Reply With Quote
  #4  
Old January 31st, 2013, 08:26 AM
handro1104 handro1104 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Posts: 10 handro1104 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 21 m 21 sec
Reputation Power: 0
Solved

$dbconn = odbc_connect("xxxx", "xxxx", "xxxx");
$sql ="select name, local_name from factory.attachments where name like '%7142930%UNCLASSIFIED.xml' FETCH FIRST 2 ROWS ONLY;";
$result = odbc_exec($dbconn, $sql);
while (odbc_fetch_row($result)) {
$fileName = odbc_result($result, 'Name');
echo "$fileName<br/>";
}

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP-DB - Problems with DB2

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap