CodeIgniter Forums
Blog Tutorial: Query results are not showing - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Blog Tutorial: Query results are not showing (/showthread.php?tid=16338)



Blog Tutorial: Query results are not showing - El Forum - 03-03-2009

[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;



Blog Tutorial: Query results are not showing - El Forum - 03-03-2009

[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>



Blog Tutorial: Query results are not showing - El Forum - 03-04-2009

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