Code Snippet
Basic Database Connection, Random Query, Display Result
<?php
define ('HOSTNAME', 'localhost');
define ('USERNAME', 'username');
define ('PASSWORD', 'password');
define ('DATABASE_NAME', 'recommendations');
$db = mysql_connect(HOSTNAME, USERNAME, PASSWORD) or die ('I cannot connect to MySQL.');
mysql_select_db(DATABASE_NAME);
$query = "SELECT testimonial,author FROM recommendations WHERE 1 ORDER by rand() LIMIT 1";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
echo "<p id="quote">" , ($row['testimonial']) , "</p> \n <p id="author">–" , nl2br($row['author']) , "</p>";
}
mysql_free_result($result);
mysql_close();
?>
Sweet!
Not the basic only. I liked it.
Thanks.
You are most welcome!
Hey friend
we guys are creating social networking site in aspx can u please give me some important tricks how i can make it more attractive
we want to create in semi flash mode can u help me
Thanks
Ambu
DigWP
A book and blog co-authored by Jeff Starr and myself about the World's most popular publishing platform.
Quotes on Design
Design, like Art, can be an elusive word to define and an awfully fun thing to have opinions about.
HTML-Ipsum
One-click copy to clipboard access to Lorem Ipsum text that comes wrapped in a variety of HTML.
Bookshelf
Hey Chris, what books do you recommend? These, young fertile mind, these.