|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Okay, hopefully I can explain what I'm trying to do good enough so ya'll understand.
I have a cfm page with a form, users fill in the fields, submit the form and it adds the data to a access database. So far I have another page loading every entry from the database but there are too many entries being submitted so my idea was to create links on the fly, dynamically, that would be displayed on the main page, and then only one database entry would be displayed at a time, with the user clicking the link on that page to load that particular entry. I'm getting pretty used to submitting info to databases and displaying that information in various ways on another page but my problem here is mainly the theory as in, how to actually go about doing what I explained. So, any advice on the kinda of process I need to implement on these pages would be appreciated. |
|
#2
|
|||
|
|||
|
In general this sounds like it should be easy. But I'm not totally sure what you want to do. Can you post some more detail, along with maybe an example of exactly what you want to see as far as the page and the link(s)?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
Sure, here goes.
add_history.cfm: user completes form and on submission, form data is put into database. (historyID, historytitle, history) display_history.cfm: database query, then output each 'history' entry from database. (#rsDisplayHistory.History# etc etc) also on this page, a link is displayed for each database entry according to the 'historyID' (using the values from the database, basically the way you display anything from a database, only it would show ALL records so that you can navigate to any of the entries. What I have hit a brick wall on, is how to go about making the links that are created based on each database record, communicate with what gets displayed on the main area of the page. I hope that helps, if I can think of any better way to explain what I want to do, or some examples that might help, I will post it. Thanks! |
|
#4
|
|||
|
|||
|
Well your main page would have a query for all the records:
<cfquery name="getAllHistory" dsn="#myDSN#"> select thistoryID, historytitle, history from historyTable </cfquery> And then output them all. You could make it output all the links, and make each one a link to a details page like this: <cfoutput query="getAllHistory"> <a href="detailpage.cfm?historyid=#getAllHistory.historyID#">#getAllHistory.historyTitle#</a> </cfoutput> Then on the detail page you could have: <cfquery name="getAllHistory" dsn="#myDSN#"> select thistoryID, historytitle, history from historyTable where historyID = '#trim( url.historyID )#' </cfquery> to get just that one item, and then output it. This is pretty basic stuff so if you're not familiar with it I'd recommend reading the Ben Forta book...it's how about 95% of CF developers learned CF. |
|
#5
|
|||
|
|||
|
Thanks very much for the help, I'll look up that book too.
One more thing though, I get a data type mismatch error if I leave the ID field as type=AutoNumber. If I change it to text the whole thing works fine. How do I go about keeping it at AutoNumber and still working? I don't understand this part very well Thanks |
|
#6
|
|||
|
|||
|
replace with:
<cfquery name="getAllHistory" dsn="#myDSN#"> select thistoryID, historytitle, history from historyTable where historyID = #val( url.historyID )# </cfquery> And seriously this sort of thing (and much more) is covered in the first 50 pages of any good CF book. If things like this are unclear to you I urge you to read through one, you'll be far more productive. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Changing dynamic content on page via links |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|