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
Writing Windows Device Drivers with C
Yes: one of the nice features of C is void*. You can put anything there and get anything out. Very
form variables from database help.
Hi all,
I would like to have a form that gives you options based on the results of an mysql q
multipart emiail forms
Hi All,
I am new to the boards and I've been working on a form (which is rather massive, imo
Multiple Pages
Hi. Im very new to php. I'm trying to create a basic login/registration page.
So I have a bas
check if string contain only a-z/A-Z
Is where any way to check if string contains only a-z/A-Z, without writing an array with all possibl
Something like an INI editor or a DelimitedText-Editor
Hi all,
Am very, very, very new to PHP and not sure if I should be posting this to a Javascri
Error: SQL Syntax; Line 1
Code:
<?php require "global_settings.php"; ?>
<title&g
What do you call the "token" thing?
You know how some sites have links that run on tokens? Tokens are links that only stay alive for a c
Which PHP-Editor do you think is the best?
Hi everyone,
Myself Brian Anderson. For the last 2 years i have been working a
Need help: how to catch acess of undefined class properties
Hello. I am learning OO with PHP and have hit a problem.
Some code runs as perfectly valid code,