CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Allow user to create and modify only their record.

Print topic Send  topic

Author Message
Jer

Posts: 25
Posted: 04/04/2008, 11:10 PM

I'd like to be able to let my users create a record with their information. Once it's created, they could update it, but not delete it.

And, they could only create one.

The creating of the record is no problem. Where I'm having difficulty is retrieving their record when they come back to that page.

I thought that the way that I could do it is to modify the SQL before it's executed. However that doesn't seem to be an option for the Record.

I created some code that is executed before the show.


  
function F_Contact_DataSource_BeforeExecuteSelect(& $sender) {  
global $F_Contact;  
  
  $F_Contact->DataSource->SQL = "SELECT * FROM contacts WHERE user_id='" .  CCGETUSERID()  . "'";  
  

that didn't work.


Any help greatly appreciated.

Thanks,

Jer
View profile  Send private message
ckroon

Posts: 869
Posted: 04/05/2008, 1:15 PM

Keep it simple.
In the where statement of the record (using the query builder)
Put a Where statement:
user_id = UserID

Make it an Integer and Session.

Done.

_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
Jer

Posts: 25
Posted: 04/05/2008, 3:46 PM

Quote ckroon:
Keep it simple.
In the where statement of the record (using the query builder)
Put a Where statement:
user_id = UserID

Make it an Integer and Session.

Done.


Hi,

Thanks. I do that for Grid. I must be blind because I'm not seeing a Query Builder for a Record.

I see:

Data Source
Primary Key
Fields for Record

I don't see anywhere I can specify a parameter. I've tried Attributes and it still didn't work. And, the examples are slightly different than my scenario. I looked through them, but they are passing the user id in the url.

Thanks,

Jer
View profile  Send private message
ckroon

Posts: 869
Posted: 04/05/2008, 5:32 PM

Select the record, in the properties dialogue box click the ... to the right of data source. That brings up the Visual query Builder.
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
wkempees


Posts: 1679
Posted: 04/06/2008, 10:10 AM

Also in the properties of the recordform you can set Delete allowed to NO
Your form (including Ckroon's advice) will now autoadd if userid not has a record yet, or switch to edit mode when user already has a recor.d

Walter

_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
Jer

Posts: 25
Posted: 04/06/2008, 12:54 PM

Thank you both. I was able to get it working.

Jer
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.