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 Like 52 Dislike
Previous forums Next forums
Other forums

Coding Critique
I was hoping someone could take a second and look down my code and see if they see any problems with

Trouble with a select list
Hello All!
I was wondering if any of you guys could help me with a small problem I'm having!

Ariba 9r - SAP MM Integration
Hi experts,

The standard Ariba adapter for 9r creates a relationship between Cost Centers

Adding to an Int row in db
Hi, i have a database which houses all of the users of my site. One of the columns is for points whi

Local file browser with php
Halo..

So this is what i want to create. I have a folder that i share and it has many movies.

path to include folder
Hi everyone,

When I'm testing locally, I have to add the name of the site folder as part of t

Not Inserting into DB
I can't get my Add new Division form to submit to the database. Anyone see my issue?

Code: &a

I would like "for" to wait 5 sec
I would like my 'for' loop to wait 5 sec before second iteration.


for ($i=0; $i<10

convert static html data into dynamic
hi all

i need to convert a website which has static above 2000 articles into dynamic and add

Help with forum quoting?
Hi im working on a forum and I have alomost finished it but i want a user quote system like twitter

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash