Welcome Guest, Not a member yet? Register   Sign In
Blog Tutorial: Query results are not showing
#1

[eluser]JenR-o-Jenny[/eluser]
Hi -- another CI newbie with a question about the Blog Tutorial. :red:

I am stuck at the step of populating the blogview.php page to output the database query results. I know it is reading the database because I get two records back but the title and body are not showing for each record.

Code is below


-- thanks in advance for help, I know the tutorials are a bit outdated (after searching the forums) and I hope I am missing something small.

Thanks,
Jenifa

Code:
<html>
<head>
<title><?php echo $title;?></title>
</head>

<body>
<h1>&lt;?php echo $heading;?&gt;</h1>
    
&lt;?php foreach($query->result() as $row):?&gt;

<h3>&lt;?$row->title?&gt;</h3>
<p>&lt;?$row->body?&gt;</p>
<p>

<hr>

&lt;?php endforeach;?&gt;



    
&lt;/body&gt;
&lt;/html&gt;
#2

[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter community!

You're right, you are missing something small.

If you're going to use short tags, you need to do them like this:
Code:
<h3>&lt;?=$row->title?&gt;</h3>
Note: the "=" sign

Otherwise, do this:

Code:
<h3>&lt;?php echo $row->title; ?&gt;</h3>
#3

[eluser]JenR-o-Jenny[/eluser]
Thanks so much, that did it!!!




Theme © iAndrew 2016 - Forum software by © MyBB