Forums

database creation, edit, view?

wayneevans 24 Aug, 2013
Hi, I am new to chronoforms and have found it very useful and quite easy to use, however I have come up against some problems. Let me explain my situation...

I have setup a website using joomla 3.1, that I plan to sell my products from, I would also like to allow members to sell their products. So I am trying to create a form that allows only me as the administrator to submit data into a database, with fields like the sellers name how many sales they have had and how much they have earned, and be able to update it as and when needed. I would then like to create another form that will display all the information specific to the seller, so when they login, they can see how many sales they have made, and how much they have earned.

So I guess my question is, can this be done using chronoforms? and if so can someone point me in the right direction for some tutorials or maybe some samples, any advice is welcome. I have had a good look around and I think it is possible but like I said, I am new to chronoforms, and a little green when it comes to code as I know very little, please help.

Many thanks Wayne.
GreyHead 24 Aug, 2013
Hi Wayne,

Yes, this can be done in ChronoForms.

That said, what problem do you have? What you've written here is an overview of an application - probably using two or three forms - but you haven't said what you've done or where you've got stuck.

I'd start out with the Admin form. You can use the Authenticator action in the On Load event to limit access and a DB Save action in the On Submit event to save the result to a database table.

You may well find more useful information in the FAQs.

Bob
wayneevans 24 Aug, 2013
Hi thank you for your reply,
The problem I was having, was extracting the information from the database, to show only the logged in users details, I have spent all night playing around and believe I have found the solution using the load user data action, and then in the where statement I added...

username='<?php echo $form->data['cfu_username'];
?>'

I have also added 2 fields to jos_users DB "sales" and "earnings" and have these display in the form. This way seems to be working, but I believe it could be done using...

<?php $user = JFactory::getUser();
?>
<?php echo $user->username
?>

I guess I am just looking for advice on what would be the best way around at this point, and is it wise to add extra fields to the jos_user db? or should I create a new db table?

Many thanks Wayne.
GreyHead 25 Aug, 2013
Hi Wayne,

I recommend that you don't add new columns to the core Joomla! tables. It may cause problems with later upgrades of Joomla!. It is much cleaner and only a little more complex to use a separate table. (The one exception is that you can add new parameters to the existing parameters column in the users table - this is used for storing language, time-zones,etc.)

The easiest and most reliable way of identifying a user is through their user id (usernames and emails can be changed in the future breaking any links that use them).

You can always get the current User ID (and other information) from the Joomla! User Object. Please see this FAQ for more info.

Bob
This topic is locked and no more replies can be posted.