Jump to content

PHP/HTML not showing text

Voids

Hello,

 

I have an issue whereby the div tags are successfully created, however, the content from the article_summary and article_title are not being displayed. Instead I have 3 rather empty div tags,

 

Code

<?php
//Connecting to sql db.
$connect = mysqli_connect("127.0.0.1","root","","leorsite");

$sql = "SELECT * FROM (SELECT * FROM article ORDER BY article_id DESC LIMIT 0 , 3) article ORDER BY article_id ASC";
$result = mysqli_query($connect, $sql);
while($row = mysqli_fetch_array($result))
	{
?>
	<div class="completeArticleHolder">
                        <div class="articleTitle">
                        <h2><?php $row['article_title'] ?></h2>
                      </div>
                      <div class="articleBodyText">
                      <?php $row['article_summary'] ?>
                      </div>
                </div>
<?php
}
?>

 

Link to comment
Share on other sites

Link to post
Share on other sites

You aren't echoeing. If you have short tags enabled, you can do

 <h2><?= $row['article_title']; ?></h2>

//Otherwise, you can just do a normal echo

 <h2><?php echo $row['article_title']; ?></h2>

 

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, Hazy125 said:

You aren't echoeing. If you have short tags enabled, you can do


 <h2><?= $row['article_title'] ?></h2>

//Otherwise, you can just do a normal echo

 <h2><?php echo $row['article_title']; ?></h2>

 

Thank you. What an amateur mistake. Thank you for the help. I have not used php in a long while. 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×