SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question can diff style be used in this code

    ok i have this code which reads from a database and displays on screen
    here is the code

    PHP Code:
    //Outputs the image and other data
    Echo "<img src=http://www.lostpetsplymouth.com/images/".$info['pname'] ." alt=\"Image\" align=\"center\" width=\"200px\" height=\"200px\" hspace=\"10px\" vspace=\"8px\"> <br>";
    Echo 
    $info['state'] . " ";
    Echo 
    $info['type'] . " <br>";
    Echo 
    "<b>Area:</b> ".$info['area'] . " <br>";
    Echo 
    "<b>Details:</b> ".$info['desc'] . " <br>";
    Echo 
    "<b>If Seen Please Tel:</b> ".$info['tel'] . " <br>"
    can a diff style be used for each echo line
    this is what i use at moment
    PHP Code:
    <div class="style2" style="font-family: Arial, Helvetica, sans-serif; font-size: xx-large; font-weight: bold"
    cheers
    Doug
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,495
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    You mean something like this?

    PHP Code:
    Echo "<img class="style1" src=http://www.lostpetsplymouth.com/images/".$info['pname'] ." alt=\"Image\" align=\"center\" width=\"200px\" height=\"200px\" hspace=\"10px\" vspace=\"8px\"> <br>";
    Echo 
    "<p class="style2">" $info['state'] . " " $info['type'] . " </p>";
    Echo 
    "<p class="style3"><b>Area:</b> ".$info['area'] . " </p>";
    Echo 
    "<p class="style4"><b>Details:</b> ".$info['desc'] . " </p>";
    Echo 
    "<p class="style5"><b>If Seen Please Tel:</b> ".$info['tel'] . " </p>"
    Of course, you'll have to define the classes in your CSS.

  3. #3
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok tried that all i get is a blank screen
    got to be me
    here is what i have done

    PHP Code:
    //Puts it into an array 
    while($info mysql_fetch_array$data )) 

    //Outputs the image and other data
    Echo "<img class="style1" src=http://www.lostpetsplymouth.com/images/".$info['pname'] ." alt=\"Image\" align=\"center\" width=\"200px\" height=\"200px\" hspace=\"10px\" vspace=\"8px\"> <br>";
    Echo 
    "<p class="style3">" $info['state'] . " " $info['type'] . " </p>";
    Echo 
    "<p class="style2"><b>Area:</b> ".$info['area'] . " </p>";
    Echo 
    "<p class="style2"><b>Details:</b> ".$info['desc'] . " </p>";
    Echo 
    "<p class="style3"><b>If Seen Please Tel:</b> ".$info['tel'] . " </p>";

    }
    ?>
    </div>
    <div> 
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,495
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    Sorry, I made a big mistake there I forgot to escape the double quotes around the class names:
    PHP Code:
    //Puts it into an array 
    while($info mysql_fetch_array$data )) 

    //Outputs the image and other data
      
    echo "<img class=\"style1\" src=http://www.lostpetsplymouth.com/images/".$info['pname'] ." alt=\"Image\" align=\"center\" width=\"200px\" height=\"200px\" hspace=\"10px\" vspace=\"8px\"> <br>";
      echo 
    "<p class=\"style3\">" $info['state'] . " " $info['type'] . " </p>";
      echo 
    "<p class=\"style2\"><b>Area:</b> ".$info['area'] . " </p>";
      echo 
    "<p class=\"style2\"><b>Details:</b> ".$info['desc'] . " </p>";
      echo 
    "<p class=\"style3\"><b>If Seen Please Tel:</b> ".$info['tel'] . " </p>";

    ?>

    </div>

    <div> 

  5. #5
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cheers buddy getting there
    the image is being shown to the left instead of centre
    Doug
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  6. #6
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,495
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by dougvcd View Post
    cheers buddy getting there
    the image is being shown to the left instead of centre
    Doug
    Well, that's a question of styling. You'd better ask those questions in the CSS forum


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
  •