On Sat, 30 Aug 2003 10:23:49 -0700
"Gloria L. McMillan" <[EMAIL PROTECTED]> wrote:

> Hi!
> 
> This is a problem of the table formatting on a form in MySQL and PHP.
> It may be in the HTML table code.
> 
> The problem is one that must be frequent.  I have a mixture of one
> character and long fill-in text items.
> 
> My table now looks awkward. Somebody gave me a complex table that puts
> colors as backgrounds behind the headers.  Could that be the problem? 
> -Gloria

The SQL has nothing to do with it (though make sure the query returns
what you expect), it's just how you format the table with the data you
have. My advice is to start it simple with no colors or stuff like that
and work on it until you get the proper table (html). Forget about using
other people's code in something like this and try to understand the
logic before you get to beautifying your output. I just spent the last
couple of days with tables formating, css, etc....
 
> 
> 
> Here is the URL to view PHP HTML table as it appears on screen:
> http://DakotaCom.net/~glomc/forms/CAT.php
> 
> Here is the mysql create table structure file:
> 
> #
> # Table structure for table 'CAT'
> #
> 
> CREATE TABLE CAT (
>    id int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
>    added datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
>    name varchar(50) NOT NULL,
>    course varchar(50) NOT NULL,
>    unit varchar(50) NOT NULL,
>    q1 text NOT NULL,
>    q2 text NOT NULL,
>    q3 text NOT NULL,
>    q4 text NOT NULL,
>    q5 varchar(10) NOT NULL,
>    q6 varchar(10) NOT NULL,
>    q7 varchar(10) NOT NULL,
>    PRIMARY KEY (id)
> );
> 
> 
> Here is the table HTML part of the PHP file:
> 
> print "<table>\n";
> while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
>  print "\t<tr>\n";
>  foreach ($line as $col_value) {
>   print "\t\t<td>$col_value</td>\n";
>  }
>  print "\t</tr>\n";
> }
> print "</table>\n";
> */
> while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
>  printf("
> <div class=\"colorfield\">
> <table>
>  <tr><th>Date</th><th>Name</th><th>Course</th><th>Unit</th>\n
> 
> <tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n
> 
>  <tr><th = colspan = 4> Q1 </th>\n
>  <tr><td>%s</td>\n
> 
>  <tr><th = colspan = 4> Q2 </th>\n
>  <tr><td>%s</td>\n
> 
>  <tr><th = colspan = 4> Q3 </th>\n
>  <tr><td>%s</td>\n
> 
>  <tr><th = colspan = 4> Q4 </th>\n
>  <tr><td>%s</td>\n
> 
>  <tr><th>Q5</th><th>Q6</th><th>Q7</th>\n
> 
>  <tr><td>%s</td><td>%s</td><td>%s</td>\n
> </table>
> 
> 
> </div>\n",
>    $row['added'],
>    $row['name'],
>    $row['course'],
>    $row['unit'],
>    $row['q1'],
>    $row['q2'],
>    $row['q3'],
>    $row['q4'],
>    $row['q5'],
>    $row['q6'],
>    $row['q7']);
> 
> }
> 
> /* Free resultset */
>  mysql_free_result($result);
> 
> /* Close the database connection */
> mysql_close($link);
> 
> ?>
> </body>
> </html>
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


-- 
Regards, Andu Novac

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

Reply via email to