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

how do I show what a user have selected from a checkbox?
From my code below, how would i show which check boxes have been checked and which radio buttons sel

Warehouse Management
Hi,

On our system, we have two storage locations ( A and B ) where A is the main factory

Show specific day of the week
I have been racking my brain trying to get this function to work properly and it is doing so for eve

for some reason mysql query not working, not inserting, please check it out
This code is not inserting anything into my db, don't know why, the $_SESSION variable does contain

setcookie and isset($_COOKIE(name)) seem very finnicky.
I'm currently playing around with a user system with login and registration. I'm trying to use cooki

Is it a good practice to store user info. in sessions?
I am making a user class for my script which stores all the user information in sessions. It takes u

How to separate records and ORDER BY
Let say i have 100 records and displayed in one page, then i want to get the records from 50-100 and

phpMailer will not connect using SMTP
I am trying to use phpMailer with smtp:

Code: [Select]$mailer = new PHPMailer();
$mailer-&

Multiple forms on the same page (safari)
Hello everyone,

I have 3 forms on the same page, that opens in a new window and submits to a

Simple AND question
Hello,

I've got following code:

Code: if(strpos($row[13],"http://")

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