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
Sessions Value Not Saved
Hi,
Im making a login form and im using this code:
Code: if($login=="true"){
Login Issue's
Code: <?php
$file = fopen('user.txt', 'r');
/* Set login to false initially */
Need help to identify this error please
:confused:Can anyone help me tell what this error message means? Maybe tell me where to look to fix
please fix the error
What is the error in the below code ???
Line number On/Off | Expand/Contract <?php
Mysql query, two times?
Hello to all,
I'm new to php coding and i like it alot. I need help with some noob stuff.
Edit MySQL Row Using PHP and HTML Form
Hello,
Here's what I'm trying to do. Build a page where a user enters a MySQL row number in.
Need help-Error istream header declaration
Hi Everyone ,
I am having issue with istream declaration. I am new to C programming.
can a
Quick Question about echo value
Hey guys, I'm trying to get something to show differently in one of my scripts. I'm trying to make
fopen() security
As i understood the usage of fopen() for it to function correctly the Dir you write to has to be rw
Specific name typed, specific image shown on html page
Hello,
Fairly new to PHP and was curious if someone might know how to solve a fairly simple r