Created
July 10, 2012 05:31
-
-
Save isapir/3081318 to your computer and use it in GitHub Desktop.
Basic Database Connection, Random Query, Display Result, equivalent to PHP script at http://css-tricks.com/snippets/php/basic-database-connection-random-query-display-result/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- first select from db !---> | |
<cfquery name="qTestinmonials"> | |
SELECT testimonial, author | |
FROM recommendations | |
ORDER BY rand() LIMIT 1 | |
</cfquery> | |
<!--- now output the data !---> | |
<cfoutput query="qTestinmonials"> | |
<p id="quote">#testimonial#</p> | |
<p id="author">– #author#</p> | |
</cfoutput> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment