using html to position results

Discussion in 'HTML' started by patrick_woflian, Mar 12, 2006.

  1. Hey, i have set up a website which allows users to search for other
    members. This code is in php and works fine, however.. to make the
    layout more attractive i was thinking of using html code segments to
    position the results in a table for example. Here is the php code, any
    ideas how to make the layout more attractive????

    <?php
    $connection = mysql_connect("sentinel.cs.cf.ac.uk","scm5sjc",
    "MyPasswordGoesHere");

    mysql_select_db("sjcdb",$connection) or die("failed!");

    $result = mysql_query("SELECT * FROM info", $connection);

    while($row = mysql_fetch_row($result)) {

    $title = $row[1];
    $first = $row[2];
    $last = $row[3];
    $age = $row[4];
    $subject = $row[5];
    $initial=$row[6];
    $email=$row[7];

    for ($i=0; $i<mysql_num_fields($result); $i++) print $row[$i]." ";
    echo "\n";
    print $title." ";
    print $first_name." ";
    print $last_name ." ";
    print $age ." ";
    print $subject." ";
    print $initial." ";
    print $email." ";

    }

    mysql_close($connection);
    ?>

    Cheers
    Steven
     
    patrick_woflian, Mar 12, 2006
    #1
    1. Advertising

  2. patrick_woflian

    Jim Moe Guest

    patrick_woflian wrote:
    > Hey, i have set up a website which allows users to search for other
    > members. This code is in php and works fine, however.. to make the
    > layout more attractive i was thinking of using html code segments to
    > position the results in a table for example. Here is the php code, any
    > ideas how to make the layout more attractive????
    >

    You're just kidding, right???? How are we to view this table without
    PHP???? Or Mysql???? Or database access???? Or the data in the database????
    Post an URL showing your test case.

    --
    jmm (hyphen) list (at) sohnen-moe (dot) com
    (Remove .AXSPAMGN for email)
     
    Jim Moe, Mar 12, 2006
    #2
    1. Advertising

  3. patrick_woflian

    Toby Inkster Guest

    patrick_woflian wrote:

    > Hey, i have set up a website which allows users to search for other
    > members. This code is in php and works fine, however.. to make the
    > layout more attractive i was thinking of using html code segments to
    > position the results in a table for example.


    How about something like this?

    print "<table>\n";
    while ($row = mysql_fetch_row($result))
    {
    $class = ($class=='a')?'b':'a';
    $line = implode('</td><td>', $row);
    $line = "<tr class=\"$class\"><td>$line</td></tr>\n";
    }
    print "</table>\n";

    with this:

    <style type="text/css">
    TABLE { border: 2px solid; border-collpase: collapse; }
    TR.a TD { color: black; background: #eee; border: 1px solid; }
    TR.c TD { color: black; background: #ffd; border: 1px solid; }
    </style>

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Mar 12, 2006
    #3
  4. patrick_woflian

    Toby Inkster Guest

    Toby Inkster, Mar 12, 2006
    #4
  5. Toby Inkster wrote:
    <snip>
    > How about something like this?
    >
    > print "<table>\n";
    > while ($row = mysql_fetch_row($result))
    > {
    > $class = ($class=='a')?'b':'a';
    > $line = implode('</td><td>', $row);
    > $line = "<tr class=\"$class\"><td>$line</td></tr>\n";

    print $line;
    > }
    > print "</table>\n";
    >
    > with this:
    >
    > <style type="text/css">
    > TABLE { border: 2px solid; border-collpase: collapse; }
    > TR.a TD { color: black; background: #eee; border: 1px solid; }

    <strike> TR.c TD { color: black; background: #ffd; border: 1px solid;
    }</strike>
    TR.b TD { color: black; background: #ffd; border: 1px solid; }
    > </style>
    >


    Small tweaks ;-)


    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Mar 12, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luqman
    Replies:
    1
    Views:
    657
    Luqman
    Feb 7, 2006
  2. Monique Y. Mudama
    Replies:
    1
    Views:
    456
    Monique Y. Mudama
    Jun 28, 2005
  3. lovecreatesbeauty
    Replies:
    8
    Views:
    1,661
    Old Wolf
    Sep 12, 2005
  4. Ken Fine
    Replies:
    3
    Views:
    539
    Steven Cheng [MSFT]
    Jul 23, 2008
  5. Arno J.
    Replies:
    4
    Views:
    89
    Robert Klemme
    Aug 14, 2007
Loading...

Share This Page