Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple help needed pls...

Status
Not open for further replies.

evismaniac

IS-IT--Management
Joined
Apr 21, 2002
Messages
14
Location
GB
Hi, I'm very new to this sort of thing but I'm picking it up ok. Anyway I have a customer registration form that stores customer details in a M$ Access database (this is for a project only). Once the user has inputed all the data and clicked submit I want the user to be able to view what they have added to the database. simple....

...well I've managed to do it ok but I need to know how to only view each customers details after each registration. At the moment it displays every customer record. If its the first entry to the database then it looks perfect. But user number 2 gets their data and user 1's. Do I need some sort of display last modified only function or something?

Thanks for any help....!
 
Do you have any primary key on the database like an autonumber field? What you could do is right after you insert the data, do another query and select the last record. Then pass that record id onto the details page where you will do another query to grab the details. What I normally do is have a "middle" page that does the insert and does a cflocation to the completion page where the id is passed into.

e.g
registration page:
<cftransaction>
<cfquery name=&quot;foo&quot; datasource=&quot;bar&quot;>
Insert into Sometable(fields)
Values(#values#) etc....
</cfquery>

<cfquery name=&quot;GetLastRecord&quot; datasource=&quot;foo&quot;>
Select Max(PrimaryKeyField) from SomeTable
</cfquery>

</ctransaction>

<cflocation url=&quot;regdetails.cfm?recordID=#GetLastRecord.PrimaryKeyField#>

Now on RegDetails.cfm:
<cfquery name=&quot;GetDetails&quot; datasource=&quot;bar&quot;>
Select * from SomeTable
Where PrimaryKeyField = #url.recordID#
</cfquery>

Then use <cfoutput> to output the data
This also has the added benefit that if someone hits refresh on the registration details, it won't insert the record twice.

HTH,
Tim P.
 
Hi, thanks for the help. Your advice sounds like a good solution. I'll let you know the results.....!

Cheers

Craig
 
You can do it like that or you can simply display the information that was entered into the form directly without querying the database. If the code is right in the page then the information will always be entered. If it is wrong then there will be an error on the page and an error message will be displayed and the information will not be displayed anyway.
Alternatively you can have a query after the insert query that matches every record entered by the user. so if two people have the same name they are unlikey to have the same other information. so it would look something like this:


<cfquery name=&quot;getinfo&quot; datasource=&quot;datasource&quot;>
select name, address, email, phone
from customers
where
and name = #form.name#
and address = #form.address#
and email = #form.emil#
and phone = #form.phone# Giles Roadnight
messenger: giles_roadnight@hotmail.com
ICQ: 81621370
 
At the moment im using something that looks like this.....ive deleted the html from it. Should I be putting 'form.' before each e.g #form.username# ?? I did try this but it didnt work. Im a bit of a novice at this so go easy on me! Thanks for any help!

<cfquery name=&quot;view_customers&quot; datasource =&quot;cjadams3&quot;>
select username,password,passhint,email,title,forename,surname,add1,add2,town,region,pcode,tel
from customers
</cfquery>

<cfoutput query = &quot;view_customers&quot;>

#username#
#password#
#passhint#
#email#
#title#
#forename#
#surname#
#add1#
#add2#
#town#
#region#
#pcode#
#tel#

</cfoutput>

<cfoutput>
#cfusion_dbconnections_flush()#
</cfoutput>
 
Status
Not open for further replies.

Similar threads

  • Locked
  • Question Question
Replies
5
Views
493
  • Locked
  • Question Question
Replies
4
Views
424

Part and Inventory Search

Sponsor

Back
Top