| | |
Oganizing a Report for Excel
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Apr 2008
Posts: 45
Reputation:
Solved Threads: 0
I am having organization set up with my table. I am trying to code for a report to have the Purchase Date and Shipped Status information added/display onto my report but I continue getting errors such as the value is not showing up and my information look out of place.
I don't know where to put the purchase date ($date) and shipped status ($status) area without making the report table go wacky...all out of place. The report open up in Excel incase anyone was wondering.
I honestly tried and move it around through out the coding still nothing. I even added some <td> tags and nothing still a mess. Could someone please help me out
I don't know where to put the purchase date ($date) and shipped status ($status) area without making the report table go wacky...all out of place. The report open up in Excel incase anyone was wondering.
I honestly tried and move it around through out the coding still nothing. I even added some <td> tags and nothing still a mess. Could someone please help me out
PHP Syntax (Toggle Plain Text)
echo "<table width=\"100%\" cellpadding=\"1\" border=\"1\">\n"; echo "<tr><td colspan=\"6\"><b>Products sold between " . $startdate . " and " . $enddate . "</b></td></tr>\n"; echo "<tr><td><b>Purchase Date</b></td><td><b>Shipped Status</b></td><td><b>Product</b></td><td><b>Quantity Sold</b></td><td><b>Unit price</b></td><td><b>Total</b></td></tr>\n"; $count = 3; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $product = $row['description']; $quantity = $row['total']; $price = $row['price']; $total = $quantity * $price; $date = $row['date']; $status = $row['status']; echo "<tr><td>$product</td><td>$quantity</td>\n"; printf("<td>%.2f</td><td>=B%s * C%s</tr>\n", $price, $count, $count); $count++; } $count--; echo "<tr><td><b>Total</b></td><td>=SUM(B3:B" . $count . ")</td><td> </td>\n"; echo "<td>=SUM(D3:D" . $count . ")</td></tr>\n"; echo "</table>\n";
Last edited by vanessia_1999; Jul 2nd, 2009 at 5:54 am.
•
•
Join Date: Apr 2008
Posts: 45
Reputation:
Solved Threads: 0
I updated the column to make sure all the column are the same and still the result is wacky.
This is the code I know have
result...............
Products sold between 01/23/2007 and 08/23/2010
Purchase Date Shipped Status Product Quantity Sold Unit price Total
7/1/2009 17:48 shipped Highlight Color Clip in Extension 100 11.99 #VALUE!
7/1/2009 17:48 shipped starbright extension 1 3.33 #VALUE!
Total 0 100
The value is not showing it is saying value instead of the number.
And the total is wrong, because it is in the wrong place. I copy and paste this info from excel so I hope it shows like how I see it.
See there is something wrong that I am doing
This is the code I know have
PHP Syntax (Toggle Plain Text)
echo "<table width=\"100%\" cellpadding=\"1\" border=\"1\">\n"; echo "<tr><td colspan=\"6\"><b>Products sold between " . $startdate . " and " . $enddate . "</b></td></tr>\n"; echo "<tr><td><b>Purchase Date</b></td><td><b>Shipped Status</b></td><<td><b>Product</b></td><td><b>Quantity Sold</b></td><td><b>Unit price</b></td><td><b>Total</b></td></tr>\n"; $count = 3; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $product = $row['description']; $quantity = $row['total']; $price = $row['price']; $date = $row['date']; $status = $row['status']; $total = $quantity * $price; echo "<tr><td>$date</td><td>$status</td><td>$product</td><td>$quantity</td>\n"; printf("<td>%.2f</td><td>=B%s * C%s</td></tr>\n", $price, $count, $count); $count++; } $count--; echo "<tr><td></td><td></td><td><b>Total</b></td><td>=SUM(B3:B" . $count . ")</td><td> </td>\n"; echo "<td>=SUM(D3:D" . $count . ")</td></tr>\n"; echo "</table>\n";
result...............
Products sold between 01/23/2007 and 08/23/2010
Purchase Date Shipped Status Product Quantity Sold Unit price Total
7/1/2009 17:48 shipped Highlight Color Clip in Extension 100 11.99 #VALUE!
7/1/2009 17:48 shipped starbright extension 1 3.33 #VALUE!
Total 0 100
The value is not showing it is saying value instead of the number.
And the total is wrong, because it is in the wrong place. I copy and paste this info from excel so I hope it shows like how I see it.
See there is something wrong that I am doing
•
•
Join Date: Mar 2008
Posts: 152
Reputation:
Solved Threads: 19
it's showing #Value! because excel is telling that what you filled in that cell is a formula that it doesnt understand.
From what I see you are trying to do, I think you want
follow that for your totals too. Not sure why you are using count there. Unless I'm misunderstanding what you are trying to put in that column, that should work.
From what I see you are trying to do, I think you want
php Syntax (Toggle Plain Text)
printf("<td>%.2f</td><td>$total</td></tr>\n", $price );
follow that for your totals too. Not sure why you are using count there. Unless I'm misunderstanding what you are trying to put in that column, that should work.
Why do Daniweb moderators edit CODE tags into CODE=style but don't check "solved".
![]() |
Similar Threads
- issue in exporting crystal report to excel on server (VB.NET)
- Export report to Excel in Asp.Net c# 2003 (ASP.NET)
- Need help in showing the report on Vb form (Visual Basic 4 / 5 / 6)
- Excel Error when Windows starts (Windows NT / 2000 / XP)
- report (Visual Basic 4 / 5 / 6)
- Visual & Excel without referencing Excel??? (Visual Basic 4 / 5 / 6)
- query for creating report group by weeks (with start date and end date of the week) (MS SQL)
- Problems with VB6 and excel (Visual Basic 4 / 5 / 6)
- How do I replace worksheets in Excel? (MS Access and FileMaker Pro)
Other Threads in the PHP Forum
- Previous Thread: how to create auto populate
- Next Thread: WAMPServer 2.0 on Vista does not run PHP
| Thread Tools | Search this Thread |
ajax apache api array basics beginner binary broken cakephp checkbox class cms code codingproblem combobox cron curl database date display domain dynamic echo email error file files folder form format forms function functions google href htaccess html image include insert interactive ip java javascript joomla js limit link load login mail malfunctioning menu mlm mobile multiple mysql nodes oop outofmemmory paging parse paypal pdf php problem procedure query radio ram random recursion reference remote return script search server sessions sms source space sql syntax system table tutorial unset up-to-date update upload url validation validator variable video web webapplications websitecontactform youtube





