Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Homepage news retrieval from MySQL
Old 08-05-2008, 06:09 PM Homepage news retrieval from MySQL
Average Talker

Posts: 17
Name: Anthony Adams
Trades: 0
I have been working on this for the past hour or two but I want to make my script where it shows only the three latest news post on my homepage, and not any more here is my code. Anyone have any ideas? Below is the site address so you can view what i have done with it.

http://www.aa1intelligence.com/development/

PHP Code:
<?php
    
require ('connect.php'); // connect to database
    
    // Retrieve News
    
$query 'SELECT * FROM newsentries ORDER BY date_entered DESC';
    
    if (
$r mysql_query ($query)) { // Run the query.

        // Retrieve and print every record.
        
while ($row mysql_fetch_array ($r)) {
            print 
"<div align=\"center\"><img class=\"newsimgheader\" src=\"lib/image/site_img/news/newsheader.jpg\"/></div><table class=\"newstable\" border=\"0\" cellpadding=\"8\" cellspacing=\"0\" bordercolor=\"#CCCCCC\" align=\"center\" width=\"98%\"><tr><td><h1 class=\"newsheader\">{$row['title']}</h1><hr class=\"newshr\"><p class=\"newsentry\">{$row['entry']}</p><hr class=\"newshr\"><p class=\"newsfooter\">{$row['date_entered']}&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;Posted By:&nbsp;{$row['added_by']}</td></tr></table><div align=\"center\"><img class=\"newsimgfooter\" src=\"lib/image/site_img/news/newsfooter.jpg\"/></div>";
    }

    } else { 
// Query didn't run.
        
die ('<p>Could not retrieve the data because: <b>' mysql_error() . "</b>. The query was $query.</p>");
    } 
// End of query IF.

mysql_close(); // Close the database connection.
    
?>
__________________
Anthony Adams -
Please login or register to view this content. Registration is FREE

System: Custom-Built, Sager NP2092, 2.5GHz Dual Core, 4GB RAM, 200GB HDD, Windows XP Pro SP3

Last edited by aa1intelligence; 08-05-2008 at 06:10 PM.. Reason: added site address
aa1intelligence is offline
Reply With Quote
View Public Profile Visit aa1intelligence's homepage!
 
 
Register now for full access!
Old 08-05-2008, 06:32 PM Re: Homepage news retrieval from MySQL
Average Talker

Posts: 17
Name: Anthony Adams
Trades: 0
I found out how to do it, thank you anyways, sorry for wasting time
__________________
Anthony Adams -
Please login or register to view this content. Registration is FREE

System: Custom-Built, Sager NP2092, 2.5GHz Dual Core, 4GB RAM, 200GB HDD, Windows XP Pro SP3
aa1intelligence is offline
Reply With Quote
View Public Profile Visit aa1intelligence's homepage!
 
Reply     « Reply to Homepage news retrieval from MySQL
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23316 seconds with 12 queries