EasyCFM.COM ColdFusion Forums / MS SQL Server Related Issues / blank shows

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: blank shows

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

gurpreet
07-04-2005 @ 9:44 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 18
Joined: Jun 2005

I am getting Error in my Jokes area Whre i am Carrying the randdom function in the List:

here is he code: it shows blank screen with no joke what i do

<cfquery datasource=#e# username="#e_use#" password="#e_pas#" name="ces">
select count(ID) as totaljokes from joke
</cfquery>
<cfquery datasource="#e#" username="#e_use#" password="#e_pass#" name="eve">
SELECT joke.ID, joke.joke
FROM joke where ID = #RandRange(1,ces.totaljokes)#
</cfquery>
<cfoutput query="eve">
<span><i>#Trim(joke)#</i></span>
</cfoutput>


Gavy Randhawa

rriyaz
07-05-2005 @ 4:20 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 58
Joined: Mar 2005

Hi gurpreet,
try this,(Assuming u are using MSSQL as your database)

<cfquery datasource="#e#" username="#e_use#" password="#e_pass#" name="eve">
SELECT TOP 1 joke.ID, joke.joke
FROM joke
ORDER BY newid()
</cfquery>

to get a random record

Hope this solves

Riyaz




Website Designed and Developed by Pablo Varando.