SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help:text and table formating

    I have 2 problems with this php(or html i dont really know , it is saved as ph so...):
    PHP Code:
    <html>
    <body bgcolor="#fffff" link="#808080" vlink="#808080" alink="#ffffff">

    <p>&nbsp;<p>
    <center>
    <font face="trebuchet ms"color="#ffffff">

    <?php
    $db 
    mysql_connect("localhost","*****","*****");
    mysql_select_db("adantas_phptestdb",$db);


    $sql_result mysql_query("SELECT * FROM agenda"$db);


    echo 
    '<table width="500">';

    while(
    $rs mysql_fetch_array($sql_result)){
    echo 
    "<tr><td>".$rs['Nome'].
    "</td><td>".$rs['Telefone'].
    "</td><td>".$rs['Nascimento'].
    "</td><td>".$rs['Mail']."</td></tr>";
    }
    ?>
    </font>
    </html>
    1. I want to change the color of .$rs['Nome']. to white and i want it with trebuchet ms.but i dont know how

    2.I want to add a row with the titles on top of the contents. and i dont know how




    i think i have somekind of dificulty in the mixing html with php


    thnx
    Last edited by SpacePhoenix; Aug 7, 2012 at 11:17. Reason: user name and password from code sample removed

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Title row? Simply use the <th></th> tags ...
    Code:
    <tr>
      <th>Nome</th>
      <th>Telefone</th>
      <th>Nascimento</th>
      <th>Mail</th>
    </tr>
    Add a colour? Just add a style to the <td> tag ...
    PHP Code:
    echo "<tr><td style=\"color: red; font-family: 'Trebuchet MS'\">".$rs['Nome']. 
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    Always learning kigoobe's Avatar
    Join Date
    May 2004
    Location
    Paris
    Posts
    1,565
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do something like this:
    PHP Code:
    <html> 
    <body bgcolor="#fffff" link="#808080" vlink="#808080" alink="#ffffff"> 

    <p>&nbsp;<p> 
    <center> 

    <?php 
    $db 
    mysql_connect("localhost","adantas_abeldant","[DELETED]"); 
    mysql_select_db("adantas_phptestdb",$db); 


    $sql_result mysql_query("SELECT * FROM agenda"$db);
    echo 
    '<table width="500">'
    echo 
    '<tr><th>Nome</th><th>Telephone</th><th>Nascimento</th><th>Mail</th></tr>'
    while(
    $rs mysql_fetch_array($sql_result)){ 
    echo 
    "<tr><td style=\"color:#FFFFFF;font-family:'Trebuchet MS'\">".$rs['Nome']. 
    "</td><td>".$rs['Telefone']. 
    "</td><td>".$rs['Nascimento']. 
    "</td><td>".$rs['Mail']."</td></tr>"
    }
    echo 
    '</table>'

    </
    html>
    Edit Oops !!!!!!!!!!! Too late ... Ian has replied already ...
    Last edited by Mittineague; Dec 27, 2012 at 11:27. Reason: pw del per OP request

  4. #4
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    once more the kind people of this forum helped me
    thnx


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •