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
Downloading file (Headers)
I'm trying to make users download a file, but they must wait 60 seconds before it begins.
But
rename the file
File.txt
Code: ***DOCUMENT***
..DN:
000044255
..CB:
..SN:
..PY:
2009
..E
Display certain image depending on time of year
Hi, I am new to these forums and would really appreciate some advice on a piece of coding I have don
New Login Script
Hi all, i attempted to create a whole new login script witch isnt working for some reason i dont kno
script and html conflict in trying to create a header.
I have an error is occurring because of an html webpage with a "php require" at the top of
first id from db not showing
I have a php script which displays the content of a mysql table as a html table with sorting, delete
show the direct link into href
I want to display link on the page. i am fetching the data(URL) from database,actually before that i
include
Hi I have this way of licensing my PHP application, and I want to know if you guys can answer some q
Sum of Values in an Array
This is probably really simple... but it's been years since I've written anything, so bare with me!<
Problems with adding a link to one position in a 'foreach' loop, please help
Hello!
Iam pretty new to programming and I wanna create a table with users from an array. It