MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community 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 August 15th, 2005, 02:50 AM
drc_huna drc_huna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 1 drc_huna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 34 sec
Reputation Power: 0
problem with while, fetch, array, result or me

Hi Gurus!
Because im a begginer, I would loke to ask you for help.
So... my application (flash) is connecting to PHP file, which should generate XML with query results. And its not, what makes me desperate.

Anyway the PHP file which is not working like it should looks like:
PHP Code:
<?php 

include_once("config.php"); 

$key $HTTP_GET_VARS[employeeid];

$result = @mysql_query("SELECT Employee.EmployeeID AS EmployeeID0, Transaction.TransactionAmount AS TransactionAmount0, Employee_1.EmployeeID AS EmployeeID1, Transaction_1.TransactionAmount AS TransactionAmount1, Employee_2.EmployeeID AS EmployeeID2, Transaction_2.TransactionAmount AS TransactionAmount2, Employee_3.EmployeeID AS EmployeeID3, Transaction_3.TransactionAmount AS TransactionAmount3, Employee_4.EmployeeID AS EmployeeID4, Transaction_4.TransactionAmount AS TransactionAmount4, Employee_5.EmployeeID AS EmployeeID, Transaction_5.TransactionAmount AS TransactionAmount5 FROM ((((((((((Employee LEFT JOIN Transaction ON Employee.EmployeeID = Transaction.EmployeeID) LEFT JOIN Employee AS Employee_1 ON Employee.EmployeeID = Employee_1.SupervisorID) LEFT JOIN Transaction AS Transaction_1 ON Employee_1.EmployeeID = Transaction_1.EmployeeID) LEFT JOIN Employee AS Employee_2 ON Employee_1.EmployeeID = Employee_2.SupervisorID) LEFT JOIN Transaction AS Transaction_2 ON Employee_2.EmployeeID = Transaction_2.EmployeeID) LEFT JOIN Employee AS Employee_3 ON Employee_2.EmployeeID = Employee_3.SupervisorID) LEFT JOIN Transaction AS Transaction_3 ON Employee_3.EmployeeID = Transaction_3.EmployeeID) LEFT JOIN Employee AS Employee_4 ON Employee_3.EmployeeID = Employee_4.SupervisorID) LEFT JOIN Transaction AS Transaction_4 ON Employee_4.EmployeeID = Transaction_4.EmployeeID) LEFT JOIN Employee AS Employee_5 ON Employee_4.EmployeeID = Employee_5.SupervisorID) LEFT JOIN Transaction AS Transaction_5 ON Employee_5.EmployeeID = Transaction_5.EmployeeID GROUP BY Employee.EmployeeID, Transaction.TransactionAmount, Employee_1.EmployeeID, Employee.EmployeeID, Employee_1.EmployeeID, Transaction_1.TransactionAmount, Employee_2.EmployeeID, Transaction_2.TransactionAmount, Employee_3.EmployeeID, Transaction_3.TransactionAmount, Employee_4.EmployeeID, Transaction_4.TransactionAmount, Employee_5.EmployeeID, Transaction_5.TransactionAmount HAVING EmployeeID0 LIKE '%".$key."%'") or die("Error ".mysql_errno().": ".mysql_error());

echo 
'<?xml version="1.0" encoding="UTF-8"?>'
echo 
'<datapacket>';
while(
$row=mysql_fetch_array($result)){ 
    
$line '<row EmployeeID0="'.$row[EmployeeID0].'" Amount0="'.$row[TransactionAmount0].'" EmployeeID1="'.$row[EmployeeID1].'" Amount1="'.$row[TransactionAmount1].'" EmployeeID2="'.$row[EmployeeID2].'" Amount2="'.$row[TransactionAmount2].'" EmployeeID3="'.$row[EmployeeID3].'" Amount3="'.$row[TransactionAmount3].'" EmployeeID4="'.$row[EmployeeID4].'" Amount4="'.$row[TransactionAmount4].'" EmployeeID5="'.$row[EmployeeID5].'" Amount5="'.$row[TransactionAmount5].'"/>'
    echo 
$line

echo 
'</datapacket>'
?>


The result of this file is like:
Code:
  <?xml version="1.0" encoding="UTF-8" ?> 
  <datapacket /> 


So it stops at line:
while($row=mysql_fetch_array($result)){
Is it possible there is a bug??

Please help.

Reply With Quote
  #2  
Old August 15th, 2005, 10:30 AM
Madpawn Madpawn is offline
My beat is correct.
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 339 Madpawn User rank is Private First Class (20 - 50 Reputation Level)Madpawn User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 22 h 3 m 33 sec
Reputation Power: 4
It looks like your query isn't returning results. Have you echo'd it out and tried running it through you db directly to make sure it's pulling rows?
__________________
"A pawn is the most important piece on the chessboard -- to a pawn"


Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > problem with while, fetch, array, result or me


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 3 hosted by Hostway