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
How to secure my login data to my database?
Hi there,
It may be a stupid question but I don't know how to secure my login data to my data
Weird Problem with curl while sending data
I am facing a weird problem with sending data to a site via curl.
If i send the value by this
Sending a hyperlink through mail
HI all,
I am sending a mail to outlook mailbox of a user using FM SO_NEW_DOCUMENT_ATT_S
Connecion issue
Hi,
For some reason, I keep getting this error when trying to connect:
Warning: mysql_
Rss feed question
Hi
My blog and my website are different. Am i able to take my rss feed
from my blog and p
Upload file!
Ok i have a form..
Code: <form name="form1" method="post" action=&quo
I think i'm using the syntax incorrectly
Hi Everyone!
I'm new to this forum and a newbie with PHP - I'm glad I found this site - I hop
PHP Surveys
I really would like some advice.
If you have a client come to you asking for a survey to be d
Help with echo()
I'm having some problems with this code:
Code: echo '
<A HREF="jav
check comment for html
hi, I just wanted to check if a comment a user posts contains HTML, and if it does, to not allow it