Re: Changing part of a query before displaying it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Would that work for multiple rows though? This is getting a varying number of rows.
Patrick Price wrote:
I believe your best bet is to change how you are iterating through the $row data. Since there are only 6 columns of data, I think the simplest solution is to remove the foreach() and handle each column's data independently, ie:
while($row = mysql_fetch_row($result10))
{
    print '
        <tr>
            <td>' . $row['first_column'] . '</td>
            <td>' . $row['second_column'] . '</td>
            <td>' . $row['third_column']/60 . '</td>
            <td>' . $row['fourth_column'] . '</td>
            <td>' . $row['fifth_column'] . '</td>
            <td>' . $row['sixth_column'] . '</td>
        </tr>';
}

Thanks

patrick


On Wed, Jul 15, 2009 at 1:10 PM, Don Collier <don@xxxxxxxxxxxxxxx <mailto:don@xxxxxxxxxxxxxxx>> wrote:

    I am quite new at this so please bare with me.
    I am getting a several rows of data from a database to display in
    a table.  One of the fields is in a format that I want to change
    before putting it in the table.  The field is time in seconds, but
    I want it to be displayed in minutes instead.  Below is what I
    have to get the data into the table.

    while ($row = mysql_fetch_row($result10)) {
              print '<tr>';
              foreach($row as $data) {
                  print "<td> {$data} </td>";
              }
              print '</tr>';

    There are 6 columns in the table and the column that I want to
    change is the 3rd one.

    How do I go about doing this?

    Don Collier

-- PHP Database Mailing List (http://www.php.net/)
    To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux