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
Echo Tweaking help!
HI. I would like to have the output of the entered variables repeat forever, but it's stopping at th
Comparing two dates
Hi Guys
I have two dates I want to compare. Below is my current implementation. The problem with
Include ("Absolute Path") of a file?
I'm not sure what I'm doing wrong. I am writing my php code in the same directory of the file that
ALV grid with 2 headers
Hi Gurus,
I need to display ALV GRID as below.
Header1
how to read and write into a word document using php...?
hi,
I need,reading and writting into a word document using php.
Thank u inadva
upload only text files
hi guys i want to upload only text like like (pdf,note pad and ofiice files) so can any one please t
Writing to the middle of a file
Hi I have a bit of a problem. Is there any way i can write some text to a middle of a text file. For
Beginner PHP code help
Hi I'm new to php but if someone could please read the question below and help it would be great.
get multiple rows
Hi I want to get multiple rows from a db
I am using this for the db query
Code: public
Schedule editor
Hi,
I have a question related to Schedule editor.
If we schedule a BLS for every 30