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
comparing tables across databases sql refinement ideas required
Hi all
Via pl/sql I need to ensure that data between tables in different databases match
Change Web page language
i doing this thing first time but i dont find any suitable solution for it. On the demand of user. I
Undefined offset
The following script checks to see if the user answer matches the correct answer.
Form Fiel
My XSRF Prevention code isn't working
First of all, thanks for the generous help you guys have given me in the past on this forum.
Seco
More pug propaganda.
http://www.youtube.com/watch?v=8Kkrmubsgf8
The commercial is definitely worth watching pug aw
Unidentified index error in a simple form
I have been trying to make an HTML form that is handled by a PHP script. So far my attempts to get i
cURL and Sessions
Ohai.
So, I'm trying to cURL a bunch of things off of a page, and put them into a session. I'
Need help in Generating Combinations
Need help generating all possible combination of names in an array
Lets say i have the follow
ob_ dynamic content
i was wondering about the potential to use ob to create a <div then remove it when the page
Number Format
Hi All,
I have number '000000000050085' I want to format it to 500.85 Can any one give me