jamcoupe Posted August 7, 2009 Share Posted August 7, 2009 Hey I have been able to make a code to fetch data from a database however after adding stylesheets and using divs and classes it does go through the rows but it wont pull the information. I have 3 records in the database and I get this: Here is what I have coded: <?php $query = "SELECT * FROM news ORDER BY id DESC"; $get_news = mysql_query($query, $connect); query_check($get_news); while ($news = mysql_fetch_array($get_news)) { ?> <div class="news"> <h3 class="news_title"><a href="news.php?article="<?php $news['id']; ?>"> <?php $news['title'] ?></a></h3> <p class="news_content"><?php $news['content']; ?></p> <p class="news_bottom">Posted by [username] on [<?php $news['date'];?>]</p> </div> <br /><br /> <?php } ?> Link to comment https://forums.phpfreaks.com/topic/169223-solved-why-does-it-loop-and-not-output-the-data/ Share on other sites More sharing options...
watsmyname Posted August 7, 2009 Share Posted August 7, 2009 Hey I have been able to make a code to fetch data from a database however after adding stylesheets and using divs and classes it does go through the rows but it wont pull the information. I have 3 records in the database and I get this: Here is what I have coded: <?php $query = "SELECT * FROM news ORDER BY id DESC"; $get_news = mysql_query($query, $connect); query_check($get_news); while ($news = mysql_fetch_array($get_news)) { ?> <div class="news"> <h3 class="news_title"><a href="news.php?article="<?php $news['id']; ?>"> <?php $news['title'] ?></a></h3> <p class="news_content"><?php $news['content']; ?></p> <p class="news_bottom">Posted by [username] on [<?php $news['date'];?>]</p> </div> <br /><br /> <?php } ?> You missed echo in <?php $news['id']; ?> and in others Link to comment https://forums.phpfreaks.com/topic/169223-solved-why-does-it-loop-and-not-output-the-data/#findComment-892887 Share on other sites More sharing options...
jamcoupe Posted August 7, 2009 Author Share Posted August 7, 2009 ahhhhh now i feel stupid Yeah that sorted out my problem thanks Link to comment https://forums.phpfreaks.com/topic/169223-solved-why-does-it-loop-and-not-output-the-data/#findComment-892892 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.