Data reporting problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
iragreenberg
Forum Newbie
Posts: 1
Joined: Sat Feb 06, 2010 2:54 pm

Data reporting problem

Post by iragreenberg »

I'll give the obliged, "I'm pretty new to PHP , so this is probably a simple question..."

I need to print/output a table of data, with user names along y-axis and data fields names along x. The data is stored in a row that includes: username, sessionnum, pagenum, formname and fieldnum. I'm a Java programmer, and I'm finding PHP arrays very unintuitive, especially when you throw in the mysql commands. I solved the problem algorithmically, but in implementation odd things (to me at least) seem to happen. For example, if I try to call a while($row = mysql_fetch_array($data)){... nested within a foreach, I get duplicate data , without the iterator moving through the array. When I run the while call not nested, the results are as expected. I KNOW there is a relatively simple and elegant way to do this, but I keep thinking in Java, which is not helping- and of course I don't have a week to read a PHP book thoroughly.
Thanks.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Data reporting problem

Post by Eran »

You should start by posting the code and pointing out where you think are your problems
limitdesigns
Forum Commoner
Posts: 25
Joined: Sat Feb 06, 2010 9:05 pm

Re: Data reporting problem

Post by limitdesigns »

Without knowing your exact code, I'm guessing your query is returning duplicate rows because you're joining tables without using SELECT DISTINCT * .
Post Reply