1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

echoing html

Discussion in 'PHP' started by dean5000v, Jun 21, 2010.

  1. #1
    Hey well i have a small problem and i dont know what the problem is.

    if you look at the small script below:

    $sql_select_jobs = $db->query("SELECT * FROM `probid_jobs`");
    while ($jobs_found = $db->fetch_array($sql_select_jobs)) {
    $template_output .= "<div class=\"listed-jobs\" style=\"border: 1px solid gray; border-bottom: 0px; padding: 20px;\">"; 
    $template_output .= "<b>Job Title:</b> " . $jobs_found['job_title'] . "<br />"; 
    $template_output .= "<b>Location:</b> " . $jobs_found['location'] . "<br />"; 
    $template_output .= "<b>Salary:</b> " . $jobs_found['salary'] . "<br />"; 
    $template_output .= "<b>Date Posted:</b> " . $jobs_found['date'] . "<br /><br />"; 
    $template_output .= "<b>Description:</b><br> " . $jobs_found['description'] . "...<a href=\"\">more</a><br />"; 
    $template_output .= "</div>";
    } 
    $template_output .= '</div>'; 
    Code (markup):
    you will see that i am selecting and displaying the fields onto the page which works perfectly, my problem is that html isnt formatting from the db. for example in some of the desciption fields in the db i have html such <b> <i> etc which does not display as html when the page is loaded. however when i manually type in <b> like so it is formatted perfectly. for example:

    <b>Job Title:</b>
     
    dean5000v, Jun 21, 2010 IP
  2. dean5000v

    dean5000v Peon

    Messages:
    201
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    for example the output would look like this:

    Job Title: fff
    Location: ff
    Salary: fff
    Date Posted: 18/06/10

    Description:
    <b>fffffffffff <i>fffffffffffffffffff</i><br></b>...more

    as you can see the description isnt using html.
     
    dean5000v, Jun 21, 2010 IP
  3. bvraghav

    bvraghav Member

    Messages:
    123
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    33
    #3
    try using
    html_entity_decode( $jobs_found['description'] )
    PHP:
    in your output

    refer
    http://www.php.net/manual/en/function.html-entity-decode.php
     
    bvraghav, Jun 21, 2010 IP