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.
Did you know?Explore Trending and Topic pages for more stories like this.
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
Join Query Help
Hi all,
I am having problems with the below code, which we shall call 'my first join query'!
IP Based Cron Jobs
I run cronjobs on my website. After one of my visitors got curious and tinkered around he realized h
my login script page is not working on remote computers
hi my login is working on my computer, but when i tried 2 computers from 2 different locations, they
Problem writing URL into database
How would I write this into the database?
<?php echo "http://".$_SERVER['SER
Retrieving the 25 most recently added entries from all tables in a MySQL databas
Hello,
The code below works great. It creates a table that shows the 25 most recently added t
Xml parsing
I need a suggestion about parsing xml with multiply parts like pervious...
i.e. different device
Loops and Classes
I am making a template system and everything seems to be going well up until I have to loop in a var
Need a fuction to count entries in a field
Hi
I need a fuction to count how many times a email address is entered in to a field.
I ma
Is STL important?
I'm just starting programming and I've made it until the Standart Template Library. But the chapter
array_diff weirdness
I'm using the following bit of code
$diff = array_diff($pids, $pidlist);
$diff = array_va