Generate columns and rows with a loop

$query = "SELECT * FROM `Sale` WHERE `Date` >= '2007-01-11' AND `Date` <= '2007-01-14' GROUP BY `Date` ORDER BY Date ASC";
$result = mysql_query($query);
How to generate columns and rows with the above mysql query to get this output:
Name/Day 11    12    13    14
Appple      30     25    26    28
Orange     5       23     12     0
Grape       7       16     0    10
The header I managed to create but not the rows. This is what I did.
<?php
$query = "SELECT * FROM `Sale` WHERE `Date` >= '2007-01-11' AND `Date` <= '2007-01-14' GROUP BY `Date` ORDER BY Date ASC";
$result = mysql_query($query);
//Header
?>
<tr>
<td valign=top>
<table cols=6 width=100% border="1" cellspacing=1 cellpadding=1>
<th BGCOLOR=#6C83B0 height="25" width="1"><font color=#FFFFFF size='1'><b></th>
<th BGCOLOR=#6C83B0 width="120" align="left"><font color=#FFFFFF size='2'><b>Name/Day</b></th>
<?
$result = mysql_query($query);
if ($daterow = mysql_fetch_array($result)) {
do {
$TimeStamp = strtotime("$daterow[Date]");
$day = date("j", $TimeStamp);
?>
<th BGCOLOR=#6C83B0 width="5" align="center"><font color=#FFFFFF size='2'><b><?echo $day?></b></th
<?
}while ($daterow = mysql_fetch_array($result));
?>
<th BGCOLOR=#6C83B0 width="5" align="center"><font color=#FFFFFF size='2'><b>Total</b></th>
<th BGCOLOR=#6C83B0><font color=#FFFFFF size='2'><b></b></th>
<th BGCOLOR=#6C83B0 width="1"><font color=#FFFFFF size='1'><b></b></th>
</tr>
<?
//Rows
$result = mysql_query($query);
if ($row = mysql_fetch_array($result)) {
do {
include("../lib/browser_sales_daily.php");
} while ($row = mysql_fetch_array($result));
?>
</tbody></table>
<?php
//browser_sales_daily.php
print <<<EOD
<td BGCOLOR=#EDEDED align="left">
<font size="2">$row[Name]</font>
</td>
EOD;
// <<<< HOW TO GENERATE ROWS HERE WITH A LOOP????? >>>
print <<<EOD
</tr>
EOD;
?>

Make sure the photos are "within" celsl and they should sort along with the rest of your data. One way to do this: select a photo that you have in the sheet that is not sorting with the data, command-x to cut, click once in a cell, and paste.  Then adjust the row height and width to make the images larger.
SG

Similar Messages

  • I use "element 12" and want  like in the old PS version due Automating and Contact  II upload multiple filesand print them with any columns and rows on the same page . How does it work?

    I use "element 12" and want  like in the old PS version due Automating and Contact  II upload multiple filesand print them with any columns and rows on the same page . How does it work?

    Can you supply a link?

  • Setting the ALV Hierarchy tree with grid line between the columns and rows

    Hi Experts,
    I would like to ask if there is any suggestion on setting the ALV hierarchy tree to be separated by grid line between the columns and rows just like how it is display the same way in normal ALV grid.
    Thanks in advance.

    Hi Lin,
    The requirement which you have stated is not possible.
    Lin,
    Also i have a query regarding BADI ZME_PROCESS_REQ_CUST, which you had raised on SDN. You have marked the question as solved/answered.
    Changing the data of a customize field in purchase requisition
    Could you please let me know, the steps you did to update the screen fields through the BADI.
    I would really appreciate your reply, because i am facing exactly the same problem which you have mentioned.
    Thanks,
    Best regards,
    Prashant

  • How to enter a data into the specified column and row in a created table

    Hi,
    I want to enter some data to specified column and row in a already created table. Please let me know how to do this.
    Regards
    Shivakumar Singh

    A table is just a 2D array of strings. Keep it in a shift register and use "replace array element" to modify the desired entry programmatically.
    If you want to modify it manually and directly from the front panel, make it into a control and type directly into the desired element. (In this case your program would need to write to it using a local variable).
    Atttached is a simple example in LabVIEW 7.0 that shows both possibilities.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ChangeTableEntries.vi ‏41 KB

  • How to get the current selected column and row

    Hi,
    A difficult one, how do i know which column (and row would also be nice) of a JTable is selected?
    e.g.
    I have a JButton which is called "Edit" when i select a cell in the JTable and click the button "Edit" a new window must be visible as a form where the user can edit the a part of a row.
    Then the column which was selected in the JTable must be given (so i need to know current column) and then i want the TextField (the one needed to be edited) be active with requestFocus(). So it would be
    pricetextfield.requestFocus();
    Problem now is that i have to click every time in the window the JTextField which was selected in the JTable. I have chosen for this way of editing because my application is multi-user and it would be too difficult for me when everybody did editing directly (catch signals, reload data, etc.).
    My question is how do I know the current column and the current row in a JTable?

    I'm not sure what your mean by the "current" row or column, but the following utility methods return
    which row and column have focus within the JTable.
    public static int getFocusRow(JTable table) {
        return table.getSelectionModel().getLeadSelectionIndex();
    public static int getFocusColumn(JTable table) {
        return table.getColumnModel().getSelectionModel().getLeadSelectionIndex();
    }

  • Read words from text file by delimiter as columns and rows

    Hi All,
    I need your help as i have a problem with reading string by delimiter. i have used various tech in java, but i can not get the result as expected.
    Please help me to get the string from text file and write into excel . i have used a text file.
    problem
    get the below as string by delimiter
    OI.ID||'|'||OI.IDSIEBEL||'|'||OI.IDTGU||'|'||OI.WORKTYPE||'|'||OI.UTR_FK
    read the below as string by delimiter
    "50381|TEST_7.15.2.2|09913043548|Attivazione|07-SEP-10
    now i need to write the above into excel file as columns and rows.
    there are 5 columns and each corresponding values
    the outut excel should be
    OI.ID OI.IDSIEBEL OI.IDSIEBEL OI.WORKTYPE OI.UTR_FK
    50381 TEST_7.15.2.2 09913043548 Attivazione 07-SEP-10
    i tried in diffrerent techinq but not able to get the resule. pls help me
    Thanks,
    Jasmin
    Edited by: user13836688 on Jan 22, 2011 8:13 PM

    First of all, when posting code, put it between two tags.
    Second of all, the pipe is a special character in regex, so you need to escape it as
    .split("\ \|");
    Erh. So 2 backslashes before the pipe character. Stupid forum won't post it.
    Edited by: Kayaman on Jan 24, 2011 9:35 AM
    Edited by: Kayaman on Jan 24, 2011 9:35 AM
    Edited by: Kayaman on Jan 24, 2011 9:36 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Avoiding zeros in columns and rows after selecting parameters

    Hi,
    I have a parameter on my report, after selecting certain value it shows me Zero Zero for all the columns and rows that do not satisfy the parameter selected and shows data in rows nad columns whre it is matching.
    Is there any way to just avaid getting anything for the rows and columns that are not matching and just getting data rows and columns......like a compact form.
    I hope I was able to explain my question.
    Robinn

    Please re-post if this is still an issue or purchase a case and have a dedicated support engineer work with you directly:
    http://store.businessobjects.com/store/bobjamer/DisplayProductByTypePage&parentCategoryID=&categoryID=11522300?resid=-Z5tUwoHAiwAAA8@NLgAAAAS&rests=1254701640551

  • Increase report size (columns and rows) in portal

    Hi all,
    Hope someone can help me with this.  I don't have any experience administering the reporting portal, hopefully this is an easy question.
    The portal displaying BI queries shows only about 10 columns and 10 rows at a time.  This is annoying since users have to scroll around to see all the rows and columns.  Where can I adjust the number of columns and rows displayed?
    Thanks,
    M.

    Hi M.B.
    Open WAD ( Bex Web Application Designer ) in which , you have assigned BI query. follow the steps for changing no of rows & columns.
    Step 1.    Properties   -  > select Web Items parametes.
    Step 2.   select  Ananlysis
    Step 3.   Scroll down  -> paging  -> here you can change no of rows & columns.
    Hope it will serve your query. If problem solved , closed this thread .
    Regards,
    Anand Mehrotra.

  • Creating even columns and rows in flash

    I need to create a grid in flash using the drawing tools. The
    grid has multiple (10+) columns and rows. Other than using the
    ruler and guides is there a way to ensure even spacing with columns
    and rows?

    Create the lines for the columns and locate the two end lines
    where they need to be using the Properties panel X positioning.
    Then, with the remaining lines placed between the two end lines,
    select all the lines and use the align tool to space them evenly.
    Do similarly for the row lines, but on a separate layer. You can
    move them to the column layer afterwards.

  • Switch columns and rows in SSRS

    Hi,
    I have a report with static columns that looks something like this:
    Date                     
    Column 1            
    Column2             
    Column30
    December 1      
       xxx                     
        xxx                    
        xxx
    December 2        
     xxx                     
        xxx                    
        xxx
    December 31      
    xxx                      
        xxx                    
        xxx
     It is based on SP that produces a temporary table exactly the same way as the report output (my Dec
    1 to 31 rows are details that are precalculated within SP).
    I need to switch columns and rows as my report is getting too wide.
    Does anyone know how it is done in SSRS 2005 (with SQL 2005 data source) without re-writing my SP?
    Thank you in advance!

    Thank you for your reply Jason.
    Unfortunately I do not have tablix within SSRS 2005; I only have matrix and table. For the original report I am using table as it displays data exactly the way it
    is passed from the SP. You cannot switch columns and rows within the table. I tried matrix, but it didn’t work either… Is there any work around that you know of?
    Thanks again!
    Lana

  • FREEZE COLUMNS AND ROWS IN WEB REPORT - PLEASE ADVISE ME

    Hi Experts,
    I have a web template that contains a query. My customer wants to freeze columns and rows in this report like we do in Excel. I know that in BW 3.5 this is not a standard feature of Table item. In forum I have found some messages regarding with this issue. I inserted a JavaScript code that I have found in forum, but this does not help. A codewriter wrote some other JaveScript for example  alert(), that works but some part of taken code from forum such as defined functions do not work.
    Other solutions advised in forum such as fixing row numbers or column numbers do not fix my problem.
    My questions:
    1 -  In new version of BW, BI 7.0 have this issue with WAD in standard been solved?
    2 - Does it really possible at the same time rows and columns to freeze? I want to freeze 2 rows from top, 2 columns from left.
    Could anyone have an idea?
    Best regards,
    Songul

    Hello,
    This will be implemented with SPS13.
    https://websmp204.sap-ag.de/~sapidb/011000358700004483762006E
    And before SPS13, i frame is useful to realize what you want to do. Using 2 "Analysis" web item. and display of 1st analysis web item is restricted only thin the header of the table and the 2nd Analysis web item is used as "table". display of this "analysis" is also restricted to 10 - 30 rows.
    but this consume hardware resource.
    <sample>
               <div style="OVERFLOW: auto; WIDTH: 1000px; HEIGHT: 20px" >
                   <bi:ANALYSIS_ITEM name="ANALYSIS_ITEM_2" designwidth="400" designheight="20" >
                       <bi:DATA_PROVIDER_REF value="DP_1" />
                       <bi:NEW_LINES_COUNT value="0" />
                       <bi:NEW_LINES_POSITION value="TOP" />
                       <bi:DATA_ROW_FROM value="1" />
                       <bi:DATA_ROW_TO value="0" />
                   </bi:ANALYSIS_ITEM>
               </div>
               <div style="OVERFLOW: auto; WIDTH: 1000px; HEIGHT: 200px" >
                   <bi:ANALYSIS_ITEM name="ANALYSIS_ITEM_1" designwidth="400" designheight="200" >
                       <bi:DATA_PROVIDER_REF value="DP_1" />
                       <bi:DATA_COLUMN_FROM value="1" />
                       <bi:DATA_ROW_TO value="0" />
                   </bi:ANALYSIS_ITEM>
               </div>
    Kind regards,
    Masaaki

  • Transpose columns and rows in numbers

    I need to transpose columns and rows in Numbers and I do not want to write script to do it.  Is there an easier way?

    Give me a proper transpose and I will uninstall Excel and never look back.
    Ok, here's a proper transpose, that can be placed in an Automator Service so it becomes a simple menu pick as below (and can also be assigned a keyboard shortcut).
    To use it (this is slightly different from Excel) you select the range you want to transpose, choose Copy Transpose, click a destination cell in an existing table in the current document or another document, and command-v (Edit > Paste) or option-shift-command-v (Edit > Paste and Match Style).
    The one-time setup is as follows.  In Automator choose File > New > Service,  drag a Run AppleScript action from the left into the right pane, choose 'No Input' for 'Services receives selected' and 'Numbers' for 'in'. Then paste the following into the Run AppleScript action, replacing all text already there by default:
    --Transpose - select range, run, paste transposed values where wanted
    try
              tell application "Numbers" to tell front document to tell active sheet
                        set selected_table to first table whose class of selection range is range
                        tell selected_table
                                  set my_selection to the selection range
                                  set first_col to address of first column of my_selection
                                  set last_col to address of last column of my_selection
                                  set first_row to address of first row of my_selection
                                  set last_row to address of last row of my_selection
                                  set str to ""
                                  repeat with i from first_col to last_col
                                            repeat with j from first_row to last_row
                                                      set str to str & (value of cell j of column i of selected_table) & tab
                                            end repeat
                                            set str to str & return -- add line return after row
                                  end repeat
                        end tell
              end tell
      set the clipboard to str
              display notification "Ready to paste transposed values" with title "Numbers"
    on error
              display dialog "Select a range first and then try again"
    end try
    --end script
    Hit the compile "hammer" and the script should indent properly. Then save the service with the name you want to appear in your menu, and it will thereafter be available via the Services menu (and keyboard shortcut, if you set one up in System Preferences > Keyboard > Shortcuts > Services).
    That's it. Less then five minutes' one-time set-up work and you've got a menu pick for a transpose functionality that is as convenient as Excel's.
    SG

  • How to make Column and Row headers bold in Web template?

    Hi Experts,
    I have a web application with a query in it. Now I would like to know how I could make the column and row headers of this webquery in bold font? I havent found any properties in any web item to make this possible. It looks like the only way to do this is CSS, but i dont have any experience with style sheets.
    Are there easier ways to do this?
    Thanks in advance.
    Rgds,
    Richard

    Tried this for fun using JavaScript.  It appears to work, but is pretty much a hack, and I didn't test it thoroughly.
    Place this in a function that is called during onload of the page:
         var eleid='';
         for(var ct=0;ct<1000;ct++) {
              eleid='ANALYSIS_interactive_mc'+ct+'_tv';
              if (document.getElementById(eleid)) {
                   if(document.getElementById(eleid).parentNode.className=='urLayoutPadless') {
                        document.getElementById(eleid).style.fontWeight='bold';

  • Excel tables... columns and row formatting after I update the indesign page

    When my excel table gets updated in indesign I lose formatting (hight/wide) for the columns&rows. There are 26 columns and each one is a difference size. Do I have to formatting (hight&wide) each column and row every time the excel table is updated?

    We have many publications with statistical tables, which are done in excel. We want to try to do some publications with only tables and do it in-house. The problem is when we place the table in indesign and finish formatting the table. We will get a updated table that needs to be updated in indesign. But when we do we update we lose all of the indesign formatting. Fixing the fonts, type size, etc is easy but how do we get back the all column widths.

  • Numbers-freezing columns and rows

    Can you freeze columns and rows in numbers although they are not designated as headers?

    FYI   I was looking for information in these old posts on the Freeze function in Numbers.  
    After looking through numerous posts and finally talking with an Apple Tech, we found that the freeze function was not in Number 08, but added in Number 09.   We were both surprised that this basic spreadsheet function was missing from 08
    With this function you can lock/freeze the top row and/or column so as you scroll through the spreadsheet, you can see you first rows or columns while looking at the data in the middle of the  spreadsheet.  
    I am not an Apple representative, but the only way to fix this and other flaws in Number 08 is to upgrade to 09 for $19.99.   Hope this helps.

Maybe you are looking for

  • Problem with Graphs

    Hi We are facing  a strange problem with graphs in BeX. We are making graph on summarized data and storing it in workbooks.The problem im facing is that whenever the query is refreshed the Graph gets scattered.for e.g X axis becomes Y  and things lik

  • Tax condition types in sd

    Could anyone can explain about the following taxes, and at what scenario the appropriate tax condition need to be used. if there is any link or blog please share . Excise Conditions: JASS     IN A/R BED JEXP     IN A/R BED JEXQ     IN A/R BED JEAP   

  • Error while doing ME57

    All, I have activated version Management for PR. Now I have generated a PR and saved it , after that done the releases . Then I have executed ME52N and add some text in item level . Then again saved the PR. Now I am doing conversion of PR into PO , w

  • Mac is enabling selective file opening after filter transfer on windows. Now it shows the newly transfered file however it cant be opened on the mac, pls help

    recently i bought a new WD 1tb hard drive to help me store more files from my mac. However as i need some files to be transfered from my old drive to my new one and since it will take ages as i have 120gb worth of pictures hence i let my laptop (pc)

  • I cannot edit a calendar event

    For some reason I am no longer able to edit an event on my home calendar.  I can create a new home event and it automatically names it new event with a default time of 11:00 a.m.  I have always been able to create an event and edit it with the detail