Scrolling news bar and MySQL
Posted on
16th Feb 2014 07:03 pm by
admin
I am not sure if this is the correct forum to post this on. If not, I apologize. I am still pretty new to PHP. I am editing a website for a friend. He had a news headlines section on his home page, but wants to change it to a news bar that scrolls through the most recent news on their database. I have been searching for help online for this and have felt like I was close, but never quite found what I needed (especially since I am new to this).
I found this tutorial (http://www.dynamicdrive.com/dynamicindex2/crosstick.htm), which is what I want... except that I don't want to use an Array for the headlines, but I want it to pull from my database. Is there an easy way for me to do this? I already have a php file from the previous news headlines section, but am not sure how to get that to work with this new code.
Here is the code for the previous headlines...
Code: [Select]<div id="news">
<?php
getHeadlines();
/*
include("admin/nCMS/nSQL.php");
$db = new nSQL("local");
$q = "SELECT nDate, nTitle FROM `gtt_news` ORDER BY nDate DESC LIMIT 5;"
$r = $db->select($q);
while($data = $db->get_row()) {
echo "<div class="newsitem">";
echo "<p class="text"><a href="#">.$data['nTitle'].</a></p>";
echo "</div>";
}
*/
?>
</div>
Please let me know if any other code is needed.
Thanks so much for your help.
No comments posted yet
Your Answer:
Login to answer
86
52
Other forums
Mysql query, two times?
Hello to all,
I'm new to php coding and i like it alot. I need help with some noob stuff.
All possible combinations of String in PL/SQL
Hi All,
Could you please explain the logic of getting all possible combinations of String
ECC6 - Single sign-on
We are in the process of upgrading to ECC 6 which will support single sign on with user passwords al
Trying to add functions to table
I have this list of characters and I'm trying to figure out what I have to do to put the results of
How to return to a previous page after running a PHP script
I'm having a bit of a melt down here because I think this should be really easy but can't work it ou
Performance impact of cookies
Hi, I was just wondering what impact there would be in terms of performance if you where to set then
Get dump of MySQL DB from Live Site
I'm after an easy, but secure way of generating and importing a MySQL dump from a remote server.
Probably Easy, Need help with Check Boxes in PHP Code
hello,
Thanks for looking this over and helping me out. My problem is I have a online store l
selectbox+database connection retrive problem
Code: [Select]
<tr>
<th align="left" scope="c
Page not Loading After Test
Hey All
It seemed that an inlcude statement wasn't working for some reason, so I tried a more