&; lt; cfquery &; gt; / &; lt; cfdocument &; gt; / &; lt; cfoutput &; gt; Dilemma
Hi allI tried to figure this on my own without
having much chance am posting here to get a
another set of eyes to review the situation.
I have a query that returns records in 29. I want
to view the output in the following way.
Page 1 (13 records) - records 1 to 13
Page 2 (13 records) - 14 to 26 records
Page 3 (03 records) - 27 to 40 documents
Here's what you see.
Page 1 (13 records) - records 1 to 13
Page 2 (16 records) - 14 to 29 records
Page 3 (03 records) - documents 27 to 29
Here is my current code. Maybe someone here
can watch over and bring to the surface what it is I'm
lack and point me in the right direction to achieve
my desired output.
< cfquery name = "qname" datasource = "dsname" >
SELECT
Count (dept_name) AS dept_count, dept_name
Of
ncrfa_value_added_leadership
GROUP BY
dept_name
ORDER BY
dept_name CSA
< / cfquery >
< cfdocument
format = "PDF".
PageType = "letter".
marginTop = ".50.
marginBottom = ".50.
marginRight = '.50.
MarginLeft = ".50.
orientation = "portrait".
unit = 'en '.
backgroundvisible = 'yes '.
Overwrite = 'no '.
fontembed = "yes" >
< cfoutput query = "rs_billing' StartRowOptional = '1' LignesMax = '13' >
#NumberFormat(CurrentRow,00) # #dept_name # < br >
< / cfoutput >
< cfdocumentitem type = 'pagebreak' / >
< cfoutput query = "rs_billing" StartRowOptional = LignesMax "14" = "26" >
#NumberFormat(CurrentRow,00) # #dept_name # < br >
< / cfoutput >
< cfdocumentitem type = 'pagebreak' / >
< cfoutput query = "rs_billing" StartRowOptional = '27' LignesMax '40' = >
#NumberFormat(CurrentRow,00) # #dept_name # < br >
< / cfoutput >
< / cfdocument >
Thanks in advance for the help
Leonard
Your method is set incorrectly... If keep you them at 13 that would work as you wish.
Tags: ColdFusion
Similar Questions
-
CFTRY isn't intercept CFQUERY Timeout error
I have a query that takes too long to run. After about two minutes, I get an error, the demand has exceeded the allowable time limit Tag: CFQUERY
First issue: I've added timeout = "300" to the cfquery tag and it did not seem have an any effect. It is an Oracle database.
Second question: I tried the < cfquery > packing in a cftry/cfcatch block. Basically, like this:
< cftry >
< cfquery... >
SQL statement
< / cfquery >
< cfcatch type = "any" >
< cfoutput > tricks < / cfoutput >
< / cfcatch >
< / cftry >
This does not seem to catch the error - it runs about two minutes again, and then displays the same error - but this time it is said Tag: cfoutput!
I tried to add a < cfthrow > before the query and then it executes the < cfcatch >.
What happens here? I've never run into something like this before.
Ken
The error is thrown by the Application Server because it times the wire.
It then reports the last tag it new topic before the thread was taking too long to respond.
For your changes to take effect you must either add:
(1) a tag of
to allow this page run more then the default AND | OR
(2) set the value of timeout requests after (seconds) for all models in the defult CF administrator.
-
Hello
I tried to create a text input area to enter a type of alphanumeric data, however it does not work for me again.
Can someone help me here is the new code 2, I added to my query results.
Basically, I have 2 pages
One is the entry (index)
And the other is where is the logic. / query
I was working on a fifth Query but now since I added the code. It doesn't yet?
Can someone help me?
Thank you.
And thank you
In the box, I have this in the index.cfm
< label > enter AN ID
< input type = "text" name = "AN_ID" / >
< / label >
In where clause is what I have the requests page or
AN_ID = ' #form. "AN_ID #
Here is the code:
index page
Sort by:
< select name = "Orderby" size = "1" >
< option value = "AN_ID" > YEAR ID < / option >
< option value = "AN_DATE" > a DATE < / option >
< / select >
< br / >
< br / >
Output format:
< input type = "radio" name = "outputFormat" value = "HTML" checked = "checked" / >
HTML
< input type = "radio" name = "outputFormat" value = "PDF" / >
PDF
< input type = "radio" name = "outputFormat" value = "CSV" / >
Download/open Excel Spreadsheet < BR / >
< BR / >
< /p >
< / make >
< p > < / p >
< / div >
< form id = "form1" name = "form1" method = "post" action = "" >
< label > enter AN ID
< input type = "text" name = "AN_ID" / >
< / label >
----------------------------------------------------------------------------------------- ------------------------------------------------------------
the query page and view the page
< cfquery name = "getHIPPOcases" datasource = "oracle10" >
Select
Thecasertab.AN_ID as AN ID
Thecasertab.AN_DATE as a date
Thecasertab_requi.case_requi_id
Thecasertab_requi.requi_type_cd
Thecasertab_requi. App_user_id
Of
thold_case
tloc
tla_prop
Thecasertab
tref_plan_area
Thecasertab_requi
where
Thecasertab_requi.caser_id = Thecasertab.caser_id
and
thold_case.caser_id = Thecasertab.caser_id
and
AN_ID = ' #form. "AN_ID #
order by
< cfswitch expression = "#Form.orderBy #" >
< cfcase value = "AN_ID" >
CASE. AN_ID
< / cfcase >
< cfcase value = "AN_DATE" >
CASE. AN_date
< / cfcase >
< / cfswitch >
< / cfquery >
<! - report html - >
< cfswitch expression = "#Form.outputFormat #" >
< cfcase value = "HTML, PDF" >
< cfsavecontent variable = "htmlData" >
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
"< html xmlns =" http://www.w3.org/1999/xhtml "> "
< head >
< meta http-equiv = "Content-Type" content = text/html"; charset = iso-8859-1 "/ >"
getHIPPOcases < title > < /title >
< / head >
< style type = "text/css" >
TD {}
do-family: Arial, Helvetica, without serif.
do-size: 12px;
}
Th {}
do-family: Arial, Helvetica, without serif.
do-size: 12px;
make-weight: bold;
background-color: #FFFF99;
}
H2 {}
do-family: Arial, Helvetica, without serif.
do-size: 14px;
}
H3 {}
do-family: Arial, Helvetica, without serif.
font-size: 15px;
}
< / style >
< body >
< cfoutput >
< table border = "0" cellpadding = "3" cellspacing = "0" >
< b >
< td align = "center" >
getHIPPOcases < h3 > < / h3 > < br > < br > < table >
< /tr >
< b >
< td align = "center" >
< / h2 > your query returned #getHIPPOcases.RecordCount # entries < / h2 > < table >
< /tr >
< b >
< td >
< table border = "2" cellpadding = "2" cellspacing = "0" >
< b >
Number < /th > < th > Record
< width th = "120" > YEAR ID < /th >
date of YEAR < /TH > < TH >
< /tr >
< cfloop query = "getHIPPOcases" >
< tr bgcolor = "< cfif currentrow mod 2 > F8F8FF < cfelse > WHITE < / cfif >" >
< td > #CurrentRow # < table >
< td > #AN_ID # < table >
< td > #dateformat(AN_date,"mm/dd/yyyy") # < table >
< /tr >
< / cfloop >
< /table >
< table >
< /tr >
< /table >
< / BODY >
< / HTML >
< / cfoutput >
< / cfsavecontent >
< cfswitch expression = "#Form.outputFormat #" >
< cfcase value = "HTML" >
< cfoutput >
#htmldata #.
< / cfoutput >
< / cfcase >
< cfcase value = "PDF" >
PDF
< cfdocument format = "pdf" >
< cfoutput >
#htmldata #.
< / cfoutput >
< / cfdocument >
< / cfcase >
< / cfswitch >
< / cfcase >
< cfcase value = "CSV" >
< NAME CFHEADER = "Content-Disposition" VALUE = "attachment; filename = Citywide.csv">
< cfcontent type = "application/msexcel" > "YEAR ID ', 'a date '.
< cfoutput query = "getHIPPOcases" > #ltrim (AN_ID) #, "#dateformat(AN_date,"mm/dd/yyyy")" # ""
< / cfoutput >
< / cfcase >
< / cfswitch >
Quote:
Posted by: briankind
on the entry
I get home an_id value let lov-1234-oop-ui
and
PRESST the button
It's notreturn results (nothing happens)
Thank youIn this case, hard-code the value "lov-1234-oop-ui" in your query instead of the form variable. You get a result?
-
Having some beginners luck with the following code.
< html >
< head >
< name cfparam = "lastname" type = "string" >
< cfquery name = "GetIndiv" datasource = "AS400" username = "quser" password = "quser" dbtype = "odbc" >
Select ISLNAM from istatic
where ISLNAM = #ucase (lastname) #.
< / cfquery >
< cfif GetIndiv.recordcount is 0 >
< Cfoutput > Invalid user or password ID < br > < br > < / cfoutput >
< cfelse >
< cfoutput > query = "GetIndiv" < br > < br > < / cfoutput >
< / cfif >
< / head >
< / html >
If the value of lastname is "Smith", then I get an error saying that Smith is not a column name.
where ISLNAM = ' (lastname) #ucase #
-
Passing parameter to function Oracler
For simplicity, I have a function which will add 1 to a number that a user enters in a form. So if the user has entered the number 2 and submits the form, the following page will display 3.
If I enter the following code in SQL Plus, I get 3:
SELECT double MySchema.Add_Function('2');
3
It is correct.
How to make this work?
< cfquery name = "funcTest" datasource = 'Test' >
SELECT double MySchema.Add_Function('#FORM.userNumber#');
< / cfquery >
< body >
Your new number is < cfoutput > #funcTest.Add_Function('#FORM.userNumber#') # < / cfoutput >
< / body >
I get
ELEMENT Add_Function('2') is undefined in funcTest.
Any ideas?
Thank youUse an alias
SELECT MySchema.Add_Function('#FORM.userNumber#') AS NewNumber
DOUBLE;#funcTest.NewNumber #. -
play with some cfquery, cfoutput and if so
Hello
I'm still learning in the very early stages of CF and I have a mini project I want to do.
at the moment there is a Flash form with a drop down, you select an item and press on submit, then query is a database and stores the result in an HTML table, pretty simple stuff.
I want to do is change the font according to something in the query.
If the Date in one of the fields in the database is smaller than NOW so the police should be red.
something like that.
I don't know where to start. I read the IF statements and what not but still do not know how to proceed.
I don't have great book of Ben Forta now and that has been VERY useful.
How would I go to do this?
Thank you
LukeSo general, with labels you can do this
code
code
code
or you can useand You can do the same sort of thing in cfscript, with a little more flexibility.
-
CFDOCUMENT - only the first PDF has the background image displayed in a loop
Here is the code example. The first PDF is created very well, but the rest files lack background image. Similar problem was reported here very strange CFDOCUMENT Bug | Blog of Raymond Camden, but I could not find a solution to this problem. Would appreciate any input!
< cfloop query = "MyQuery" >
"< cfdocument format ="PDF"filename="./docs/#filename# ".
Overwrite = "yes".
localURL = "true" >
< ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""
< html >
< head >
< style type = "text/css" >
body
{
background - image: URL('image.jpg');
background-repeat: repeat no.;
}
< / style >
< / head >
< cfoutput >
< body >
< table width = "100%" cellpadding = "0" border = 0 > < b > < height td = "280px" colspan = "4" > < table > < /TR > < tr valign = "top" > < td align = "center" colspan = "4" > < span style = "do-size: 48;" do-family: Calibri; color: black; make-weight: bold; "> #FirstName # #LastName #. </span > < br > < span style = "do-size: 25;" do-family: Calibri; color: black; make-weight: bold; "> for the </span > < br > < span style = "do-size: 48;" do-family: Calibri; color: black; make-weight: bold; ' > '. project #qNomination.proj_name #. </span > < br > < table > < /tr > < / body > < / cfoutput >
< / html >
< / cfdocument >
< / loop >
The example I gave you would work. It's just dynamic as I'll now show.
In the following example, save CFM 2 files and image files in the same directory. Then open testFile.cfm in the browser. This will dynamically create 3 PDF files in the current directory
testFile.cfm
Inc.cfm
Content of body HTML of the page #idx. #
-
Hello
I properly connected and questioned a ledge open progress 10.2 B of the data base and threw the data using < cfdump >. I tried to use < cfoutput query > successfully.
Please see below,
< name cfquery = 'list' datasource = "current year1 >"
SELECT "employee." "" Employee-ID ","employee ". "' Name of the employee."SAM". "" BUB ". "' Employee '.
Where "employee". "Active file"= "1"
ORDER BY 'employee '. "' Name of the employee.< / cfquery >
< request CFDUMP = 'list' > / displays all the fields in the selection above.
When I try to use < cfoutput > # 'employee '. "Employee ID" # < / cfoutput > "
I get errors. I tried with "and" and with only # and many others.
Please if anyone knows and has demonstrated successfully this data using < cfoutput >
Thank you
TJ
Hi haxtbh,
I just it!
Assign an allises to "Employee1". "' Employee name ' as EMPN
Export the field in the form
#list. EMPN # Thanks for the reply.
TJ
-
Headers for each change in a Cfoutput
I have and try to make an exit that lists the name of a complex of apartments and it's corresponding task each time that changes their apartment number
< cfquery name = "Running_list" datasource = "c124805-h217079" >
SELECT Read, LisUnitNo, LisTask, LisNotes, LisStatus, LisPriority, Lisduedate, lissideoftownproname
OF listrun
LEFT JOIN ON LisUnitNo property = proid
ORDER BY LisUnitNO, LisPriority /, Lisduedate/desc
< / cfquery >
my exit code looks like this
< cfoutput query = "running_list" >
#Running_list.proName #-priority: #Running_list. LisPriority # < br / >
#Running_list. LisStatus #.
#Running_list. LisTask # < br >< / cfoutput >
My result displayed exploration to looks like this:
HMC 508 NAS - priority: 3
Place mats inside the closet
HMC 508 NAS - priority: 3
Install the door behind the kitchen door stop so that it will not hit the firm.
HMC 508 NAS - priority: 3
Paint the inside of the back door kitchen
HMC 508 NAS - priority: 3
Check the closet PVC HVAC pipe
HMC 508 NAS - priority: 3
Clean the paint of the mini-blinds in the living room
HMC 508 NAS - priority: 3
Touch-up paint double a closet door in the room from behind.
----------
NAS AV 102 B
1 ShopVac HVAC closet
2 spray foam all the vents and frame the set inside PVC line.
I want my result to looks like this:
MANOR COMMUNITY HISTORY
Apartment 508 NAS
1. install the carpet inside the closet
2. install the door behind the kitchen door stop so that it will not hit the firm.
3. paint the inside of the back door kitchen
4. check the closet PVC HVAC pipe
5. clean paint of the mini-blinds in the living room
6 closet remodeling painting double door at the back of the room.
----------
ALPINE VILLAGE
Apartment 102-B
1. closet ShopVac HVAC
2 spray foam all the vents and frame the set internal PVC line.
Is - it the way I do the cfoutput code?
If you want to group under the name of the apartment, then you can use the cfoutput group attribute and specify the column that identifies uniquely the apartment (LisUnitNO perhaps), then you can nest another tag cfoutput inside and to list each of the records in this group. Make sure that the column in the group attribute is also in your SQL order by attribute.
For example:
#running_list. ProName #.
- #rulling_list. LisTask #.
-
Selects related and showing CFQUERY value
I have a form that works well. Using a CFC, I have two CFSELECTS that are related. A selection on the first determines the display on the second. So far so good. But then I started thinking that users must remember what they choose. In the first CFSELECT, the value is a user ID. I want to use it to fill a CFINPUT or simply a CFOUTPUT, but this must be linked to the CFSELECT. If the user chooses his name. Fills a second CFSELECT with choice so she can choose. But in the meantime, I want to show a choice she made months ago, and it's a value I caught in the CFFUNCTION that is related to that CFSELECT.
Is there a way to display a different value after the CFSELECT? A value other than my CFQUERY in the CFC has already caught?
It would be really nice. I could then, as soon as a user has chosen his name, show his user ID and other information, and also show him this selection of some material she made months ago and forgotten.
Then the form would go to the second CFSELECT where she would pick a date for the service tech. But I think this part is irrelevant to what I want to do in the meantime.
I googled this scenario and the most likely solution is something like that.
Within a CFFUNCTION and a component, I would put something like that
< cfset var userModel = [Nomrequete] .userModel > (I'm guessing here)
< cfreturn userModel >
And then I'd be able to bind a CFINPUT for this component and function and display the userModel.
The user would see this and remember this that the material she chose and then continue to choose a date for it.
I tried variations on it but still get a message indicating that the parameter was not passed.
I got it. I just need to refer to the previous selection, like this. link = ':cfc.laptopModel.getModel({employeecfc}).
-
Select / option with cfquery - how to pass the value selected in the downform field
I have a form that has a drop-down list selection/basic option using a cfquery result. I would use the value that the user selects to pre-fill an editable field "title" more far along on the form. For example:
< do action = "" index.cfm? fuseaction = sendEmail "method ="POST"name ="email_approval"enctype =" multipart/form-data">"
< table width = '500' border = "1" cellspacing = "0" cellpadding = "2" align = "center" >
< b >
< td align = "left" > request ID: < table >
< td align = "left" width = "100" > < b > < cfoutput > #RequestId # < / cfoutput > < / b > < table >
< td align = "left" > Application: < table >
< td align = "left" width = "400" > < b > < cfoutput > #this_request.app_abbrev # < / cfoutput > < / b > < table >
< td align = "left" > WR / RD #: < table >
< td align = "left" width = "400" > < b > < cfoutput > #this_request.request_number # < / cfoutput > < / b > < table >
< /tr >
< b >
< td align = "left" > Email Type: < table >
< td align = "left" colspan = "2" >
< select name = "approval_type" size = "1" >
< cfoutput query = "approval_types" >
< option value = "" #approval_types.approval_descrip # "style =" do-size: 8pt "> #approval_types.approval_descrip # < / option >"
< / cfoutput >
< / select >
< table >
< td align = "left" > < table >
< td align = "left" > Date: < table >
< td align = "left" > < b > < cfoutput > #dateformat (Now (), ' MM/DD/YYYY') # < / cfoutput > < / b > < table >
< /tr >< cfset subjectLine = "#RequestId #" & "" & "Request approval" and the "#approval_types.approval_descrip #" >
< script type = "text/javascript" language = "JavaScript" >
< cfoutput >
var #toScript (subjectLine, "jsLine") #.
< / cfoutput >
< /script >< script type = "text/javascript" language = "JavaScript" >
setValue() function
{
document.getElementById('subject').value = jsLine;
}
< /script >
< b >
< td align = "left" > subject: < table >
< td align = "left" colspan = "5" >
"< b > < input type ="Text"name ="topic"required ="Yes"size ="70"maxlength = onClick =" setValue () "70"; ' > < / b >
< table >
< /tr >
.......When the user gets to the field for the object the onClick préremplira the field with the value combined with < cfset subjectLine = "#RequestId #" & "" & "#approval_types.approval_descrip #" & "Application for leave" >. regardless of what is selected, it uses the first element in the query list because it is what is rendered when the form is loaded (who won). I tell me that I need an onChange event of javascript for the select statement for the drop, but can not find a way to pass this variable javascript back to form CF. Any ideas, or am I stuck?
Thanks in advance for your ideas!
Unless you use a more recent version of CF (I think 7 or 8-9), in which case if the form is a FORM, and then select is a CFSELECT, and the fields are CFINPUT, you can use BIND = "" in the CFINPUTs to detect the @change of the CFSELECT and fill accordingly. "
^_^
PS: I love JavaScript, I'm a JScriptin' fool, sometimes... but if this can be managed by CF, why not? (shrug)
-
Hello
I came across the following code:
<html> <head> <title>Employee List</title> </head> <body> <h1>Employee List</h1> <cfquery name="EmpList" datasource="cfdocexamples"> SELECT * FROM Employee </cfquery> </body> </html>
If the code selects all rows (records) and the columns (fields) in the Employee table and stores this information in EmpList
The question I have is how do you use the same * ouput rating all the columns for each row in the returned query? Which means something like:
< cfoutput query = "EmpList" >
* < BR >
< / cfoutput >Thank you
Jim
There is no simple way to do that, because there is little CF point output just function which is essentially that the data formatted with no control over the format you him.
What you doing this? Just for debugging, or a request? If it is debugging, use CFDUMP.
However, there is always a way, and the key is the secret [Nomrequete]. ColumnList, on which you can iterate as any other list.
Complete example:
hit a 'false' request for testing
qEmployees = queryNew ("name, age, position, 'VarChar, whole, Varchar');
queryAddRow (qEmployees);
querySetCell (qEmployees, 'Name', 'Dave');
querySetCell (qEmployees, 'Age', 21);
querySetCell (qEmployees, 'Position', 'Personal');
queryAddRow (qEmployees);
querySetCell (qEmployees, 'Name', 'Phil');
querySetCell (qEmployees, 'Age', 42);
querySetCell (qEmployees, 'Position', 'Manager');
queryAddRow (qEmployees);
querySetCell (qEmployees, 'Name', 'Barry');
querySetCell (qEmployees, 'Age', 71);
querySetCell (qEmployees, 'Position', 'Sitting');
#qEmployees [listGetAt (qEmployees.ColumnList, iCol)] [CurrentRow] #.
-
Hi peeps - you have a little tedious problem.
I am running a cfquery on a database of recovery of the column names are stored in a table.
The cfquery works very well, and I can't cfdump of data with no proolem at all, however once I try to put out inside a cfoutput, instead of the value of the fields, the output displays the names of the fields. I think it's because I nested a cfloop to inside the thew cfoutput tag field names:
< cfoutput query = "qGet_cust" >
< b >
< td > #MID (LEGAL_ENTITY_CODE, 2, 10) # < table >
< cflock scope = "session" throwontimeout = "Yes" type = "readonly" timeout = "10" >
< cfloop FROM '1' TO = = "#ArrayLen (SESSION.parameter_array)" # "index =" LOCAL.this_var ">"
< cfset LOCAL.this_column = ". qGet_cust" & "#SESSION.parameter_array [LOCAL.this_var] [1] # ' >
#LOCAL.this_column # < td > < table >
< / cfloop >
< / cflock >
< /tr >
< / cfoutput >The first column is the LEGAL_ENTITY_CODE domain name, and that copies the data from the cell without problem. However, the following cells show that the name of the column, rather than the content
Header 1 Header 2 Header 3 Legal person Current year of Internet access Calls and lines the current year 0003272773 qGet_cust. INTERNET_ACCESS_cyr qGet_cust. CALLS_AND_LINES_cyr 0002808637 qGet_cust. INTERNET_ACCESS_cyr qGet_cust. CALLS_AND_LINES_cyr 0001464359 qGet_cust. INTERNET_ACCESS_cyr qGet_cust. CALLS_AND_LINES_cyr
How can I get the code to multiply the contents of the request, rather than the column names? I am running CF MX7. Thank you.But the first example, #qGet_cust [SESSION.parameter_array [LOCAL.this_var]] [1] # if it is to launch this error, which simply means that I didn't put in the correct, complete structure that contains the column names in the first query [row] [column] structure brackes.
Altogether. From the original code, this is the correct name:
IE: the column name is ' #SESSION.parameter_array [LOCAL.this_var] [1] #
If the correct query [column] [row] representation of this would be:
qGet_cust [SESSION.parameter_array [LOCAL.this_var] [1]] [qGet_cust.currentRow]
Ian used [1] of the ref column name as a line (by accident) ref.
--
Adam
-
SQL query and question CFOUTPUT
Hello
I am trying to compare two tables in a database. I need a few fields in a table of output, to compare a field between the two tables. Users choose the tables. I've written a SQL query that does what I need:
< cfquery name = "getitems" datasource = "snapshot" >
Select #endtable # .field9 #endtable # .field12, #endtable # .field4, #endtable # .field13, #endtable # .field2, #endtable # .field3, #starttable # .field3
of #endtable #, #starttable #.
"where #endtable # .field5 =' #form.field5 #"
and #starttable # .field2 = #endtable # .field2
< / cfquery >Problem is on the output. You can see that I am selecting field3 in two tables. I want also to two output field3 values.
< cfoutput query = "getitems" >
#field3 #.
< / cfoutput >
This gives me the value that was chosen as #endtable # .field3.
How can I exit the other - .field3 of # #starttable?
As mentioned, the table names are variable being passed in the query... Thank you!
Peter
How can I exit the other - .field3 of # #starttable?
Use an alias to give different names fields IE table.column AS unnom. Otherwise, cfquery do not know what field do you mean when you say "field3".
Select #endtable # .field9, #endtable # .field12,.
Be careful when using this type of sql. According to the source of your variables, this can pose a risk of sql injection.
-
Hi all
I created a random generator of product for my website that pulls a random product using cfquery and the poster with a query cfoutput. Everything works fine, except that it's extremely slow as it moves through 37 000 records. Someone at - it a more fast/best way to get a random record display (on the refresh of the page is displayed a new record at random)
Here's my query:
< = 'elements' dataSource cfquery name = "mydata" >
SELECT NAME, DESCRIPTION
OF the product_catalog
ORDER BY NAME
< / cfquery >Here's my cfoutput query
< cfoutput query = 'elements' StartRowOptional = "' #displayRow # ' LignesMax '1' = >"
This is the result of the cfoutput query
#items.NAME #.
Thank you!
(1) create a new column, product_id, to use as the primary key. This is essential to your design, in any case, now and later.
Make an AutoNumber field. Then, you can conveniently use the fact that it is an integer field, as shown below.
(2) it should run fast
SELECT count (*) as numberOfProducts
OF the product_catalog
You can do even better. This request, as your request, assumed that the catalogue of products changes constantly as demand is growing. This is generally not the case for most applications.
If your product catalog remains the same for the application, you must define the following query, preferably in your Application.cfm or Application.cfc:
SELECT count (*) as numberOfProducts
OF the product_catalog
It is much more effective, as Coldfusion bed only once during the duration of the application.
(3) this is the line of number generators:
(4) Finally, the request main. Very effective, because it gets just one line.
SELECT *.
OF the product_catalog
WHERE the product_id = #random_id #.
Maybe you are looking for
-
space requirement: this library file to move?
Hi all I have all my photos on Mac and on my backup unit Last year, after buying my new MacBook, I did some work to migrate from old to new. Now I need free space on Hd on my Mac and my/images folder I have these files: -' Library foto' gb75 (also I
-
Hello I live in the Japan, but I have my app store connected to the European area. I want to know that if I buy an iTunes gift card to a local store (in Japan) I can still use it in my European account, to spend in games or inside them. Thank you and
-
Hi I am new in programming with LabVIEW and I try to create a program that allows to estimate gear changes based on how fast the vehicle of support falls. The speed is measured by an OBD device and the results are saved in a spreadsheet. I created a
-
Hi all I want to automate MS Outlook using ActiveX. My requirement is to fill out the address of a new mail through LabVIEW line. Thanks in advance Karine
-
Im trying to get my money back on something that I've ever received
who or where can I contact someone to help him with this problem.