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
Change Sort Order to Display Newest File First
Hi Guys,
I have a page that sorts the contents (PDFs) of a directory and displays them on the
GMail like Chat in ASP.NET
Hi,Can anyone suggest me, how to incorporate GMail like chat in my existing ASP.Net application.I wa
Slashes
Have a small problem and I'm not able to understand why I'm getting the results I'm getting... and i
contact form - output to page and email
I have the following in my controller:
$message['name'] = htmlentities(strip_tags(trim($_POST
PHP Directory Listing Not working
Hey Guys,
I need help, I tried a ton of directory listing scripts and they all don't work. Al
Standard DES encryption script?
Can anybody point me to a tutorial or a short script that shows how to encrypt some text with salt i
error checking breaking my code
Hi there, OK first of all, big apologies for what I assume is really fundamental errors in the struc
Coefficient of a Restitution Hints
Hello. I was wondering if anyone can give me hints on how to write this program...
The coeffi
Sharing PHP Sessions Across Domains
I am in the process of writing a script to share a php session across various domains I have.
The
cstdatomic (c++0x std::atomic) / g++ 4.4
Hello,
I'm trying to use cstdatomic (std::atomic in the upcoming c++0x standard) in g++