Re: printing an array

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

 



Hi,

usually, one issues an HTML row for each row of the query result.
BTW, don't forget <TR> elements!

But your query results has only one row, and your table has 4 columns.

Can you explain in more detail what you want to do?

Ignatius
____________________________________________
----- Original Message -----
From: "Chris Grigor" <chris@calibre.co.za>
To: "PHP Gen" <php-general@lists.php.net>
Cc: "PHP DB" <php-db@lists.php.net>
Sent: Thursday, October 24, 2002 10:07 AM
Subject:  printing an array


> Hey there all
>
>
> Im sure that someone out there can answer this question..
>
> I have a problem, how can I print each element in an array so that is
> returned into a table?
>
>
> eg
> <table width="100%"
> <th width="25%" nowrap>
> Test1
> </th>
> <th width="25% nowrap>
> Test2
> </th>
> <th width="25% nowrap>
> Test3
> </th>
> <th width="25%">
> Test4
> </th>
>
> <?php
> include("common.inc");
> $link_id = mysql_connect($dbhost, $username, $password)
> or die ("Connection Failed");
>
> mysql_select_db($db);
> $query = "select Routine_Tests_Count from CDT_Routine_Tests where Ref_num
=
> '$ref_num'
> order by Routine_Tests_Link;
>
> $result = mysql_query($query, $link_id)
> or die ("Query on $dbhost failed);
>
> while ($row = mysql_fetch_object($result)) {
> print "<td>$row->CDT_Routine_Count</td>";            <---------------
(This
> value holds the Results of test1 test 2 etc
> that I need to print into the table)
> }
> mysql_free_result($result);
>
> ?>
> </table>
>
> Any help with this or direction would be appreciated !
>
> Regards
> Chris
>
>
>
> --------------------------------------
> Chris Grigor
> --------------------------------------
>
>
>
> --
> 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