SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    if article have image how to add div container with border arround image

    $A_SQL = "SELECT Vijesti.ID, LEFT(NewsText,600), Title, AID, Date, NewsDate, pictureID," .
    "DATE_FORMAT(NewsDate, '%d.%m.%Y.') as formated_date " .
    "FROM News, Categories, NewsCheck WHERE Name LIKE '%News - Block%' AND CID=Categoies.ID AND JID=News.ID ORDER BY NewsDate DESC LIMIT 3";

    .....

    while ($row = mysql_fetch_array($fetch_sql)) {
    $pcitureID = $row['pictureID'];
    echo("$pictureID, $newstext");
    ...
    }
    Now question is how to add image outer border arround pictureID (image on website) and to avoid empty border background if news article doesn't have image.
    Anyone ?

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    How is the lack of a picture represented in the database? Will pictureID be null?

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2009
    Location
    South Florida
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you explain little more about how you store data. Mainly pictureID

  4. #4
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if news article doesn't have image then pictureID is null.

  5. #5
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    while ($row mysql_fetch_array($fetch_sql)) {
        if (!empty(
    $row['pictureId'])) {
            echo 
    "<div style='border: 1px solid #000'><img src='???' /></div>";
        }
        echo 
    $newstext;


  6. #6
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Do you really need that div around the image?

    Using CSS, you can give that image padding and a border, without the need of a container div.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  7. #7
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ofcourse many thanks


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
  •