Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8569167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:16:19+00:00 2026-06-11T18:16:19+00:00

On my website I have some images that are stored in the same SQL-cell

  • 0

On my website I have some images that are stored in the same SQL-cell as the rest of the content. When I load the page containing the images and PHP echoes the ‘article’-cell, the images are automatically enclosed in paragraph-tags, which is not what I want. Is there any way to prevent this? I’m not exactly sure wether it’s a browser-side or a server-side issue, but it appears in botch Chrome and FF.

SQL-cell ‘article’:

<img src="http://www.nasa.gov/images/content/297522main_image_1244_946-710.jpg"><p>Lorem ipsum</p>

PHP Code:

if ($pageType == 'article') {
            if($pageExists==1) {
                try {
                    $db = new PDO('pdoinfo');
                } catch(PDOException $e) {echo $e->getMessage();}

                $sql = $db->query("SELECT * FROM articles WHERE id=$pageName");
                $result = $sql->fetchAll(PDO::FETCH_OBJ);

                echo ('<div class="article"><h3>');
                echo $result[0]->title;
                echo('</h3><p>');
                echo $result[0]->article;
                echo('<span class="article-data">Geplaatst op <span class="article-date">');
                echo date('d-m-Y', strtotime($result[0]->postdate));
                echo ('</span> door <span class="article-author">');
                echo $result[0]->author;
                echo ('</span><span class="article-broadcast"><span class="st_twitter_hcount" displayText="Tweet"></span><span class="st_facebook_hcount" displayText="Facebook"></span>');
                echo ('</span></span></div>');
            }
            else {
                include('pages/404.php');
            }
        }

Output HTML:

[...]<p><img src="http://www.nasa.gov/images/content/297522main_image_1244_946-710.jpg"><p>Lorem ipsum</p>[...]

I just code everything myself, so no CMS involved.
When I enclose the image with p-tags myself, a redundant empty p-tag get’s inserted before the paragraph.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:16:20+00:00Added an answer on June 11, 2026 at 6:16 pm

    You have an opening <p> on this line echo('</h3><p>'); that never closes so i suspect your seeing that.

    There is also no need for all thos echos’s

    echo '
    <div class="article">
        <h3>'.$result[0]->title.'</h3>
        '.$result[0]->article.'
        <span class="article-data">
            Geplaatst op <span class="article-date">'.date('d-m-Y', strtotime($result[0]->postdate)).'</span> door 
            <span class="article-author">'.$result[0]->author.'</span>
            <span class="article-broadcast">
                <span class="st_twitter_hcount" displayText="Tweet"></span>
                <span class="st_facebook_hcount" displayText="Facebook"></span>
            </span>
        </span>
    </div>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a website that has some images that I need
I have some static images in a folder on my IIS 6-based website that
I have a website in c#, in the first page I have some listbox,
I have some pages on my public website that display charts generated by ASP.NET
I have some javascript that I am using for some audio on my website:
Problem I have some pages that need dynamic data from website to generate output
I have some xml files that contain text, which are displayed on my website.
I have a website and it uses a lytebox to show some images and
This is my website tryout upload: My portfolio it seems that some images are
I have a Joomla website and I observe a problem with some images. In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.