English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have 2 pages with the EXACT SAME CODE. 1 works one doesn't. I put the code on the same page to determine why and I cannot figure it out.

Below is my test code. The second query, bookS pulls random data. The query, book stays the same. on the actual pages of the sites, they are named the same.



2007-04-15 15:09:23 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

The tables are exactly the same and have the exact same info in them. but I want BOTH db's on different sites to query the same way. The RAND is work on one but not the other. EVERYTHING IS IDENTICAL.

I listed the db's with different names above to put them both on a test page

2007-04-17 08:37:22 · update #1

2 answers

In your example code, the datasources of the two queries are different. Unless they point to the same database, you would get different results using the same query against two different datasources.

By the way, the Rnd( ) function you're using is the SQL Rnd( ) function, not a CFML function.

2007-04-17 07:05:44 · answer #1 · answered by Defenseman Emeritus 3 · 0 0

Which version of Cold Fusion is this?

In CF6, you should be using RandRange. RND is not a CFML function that I know of unless you got some custom libs loaded.

http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt261.htm#1110957

If that's not the issue, I'm going to guess that the tables are slightly different and the function gave something that cannot be queried.

EDIT: Oh, now I feel dumb. :D

It looks like you're trying to recreate this tip... If so, aren't you missing the "top X" results?

http://www.tek-tips.com/faqs.cfm?fid=2534

2007-04-15 23:58:34 · answer #2 · answered by Kasey C 7 · 0 0

fedest.com, questions and answers