Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

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 Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old December 17th, 2003, 07:02 PM
rd42 rd42 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: peoria, IL, USA
Posts: 64 rd42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Inner Join Query

I have an inner join between two tables, the mysql query works with in phpmyadmin returning the correct values, but in php it returns nothing.( nothing I can see anyway) Any ideas on what I could be missing? I'm user the PEAR class for database connection.

PHPmyAdmin query
php Code:
Original - php Code
  1.  
  2. SELECT accounts.account, tickets.ticketno, tickets.createdate, tickets.status, tickets.description, tickets.priority, tickets.assignedto FROM accounts INNER  JOIN tickets ON accounts.accid = tickets.accid WHERE tickets.status<>'CLOSED'

php Code:
Original - php Code
  1.  
  2. $sql = "SELECT accounts.account, tickets.ticketno, tickets.createdate, tickets.status, tickets.description, tickets.priority, tickets.assignedto FROM accounts INNER  JOIN tickets ON accounts.accid = tickets.accid WHERE tickets.status<>'CLOSED'";
  3. $ticketsResult= $db->query($sql);
  4.  
  5. while ($ticketsRow = $ticketsResult->fetchRow()) {
  6. echo $ticketsResult[0];
  7. echo $ticketsResult[1];
  8. echo $ticketsResult[2];
  9. echo $ticketsResult[3];
  10. echo $ticketsResult[4];
  11. echo $ticketsResult[5];
  12. echo $ticketsResult[6];
  13. echo $ticketsResult[7];
  14. }

Reply With Quote
  #2  
Old December 17th, 2003, 07:08 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: Inner Join Query

you are trying to echo the wrong array variable

change these...
$ticketsResult[0] etc...etc

to

$ticketsRow[0] etc...etc

Reply With Quote
  #3  
Old December 17th, 2003, 07:23 PM
rd42 rd42 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: peoria, IL, USA
Posts: 64 rd42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Inner Join Query

Thanks again, I got so carried away with the inner join that I forgot about the obvious.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Inner Join Query


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway