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
rookie looking for help coding a CSS form with PHP
I'm trying to figure out how to add PHP code to my xhtml form so that it is a working form embedded
Most basic form question ever?
Hello,
I want to use this snippet to make sure the fields in a form are ok before processing
help with mysql_error()
Hi,
I am trying to insert data into a table, but I am not able to insert it. I wanted to see
I am stumped
OK. Here is what I am trying to do. I have the conditions set, and if the conditions are met, I want
curl javascript problem
Hi Experts.
I'm new curl and wanna to get some info from this http://www.amadeus.net/
when
Price in PR
Dear Experts,
Why we have to enter the price in the PR, and why there is no free goods indicato
Setting/Modify Headers using mail() function
I have a question about setting email headers when using mail() in a php script.
When I send
C problem struct and string
Hi guys,
This is my first post and I'm hoping the experts here can help me solve my problem.<
Greek characters in php
Hi,
I'm making a script and I m using for first time greek characters.
I started to write
problem with sql querry in php script
Hello guys,
What I want to do is I want to read out a csv file and then but te conent ot the