(SOLVED...Partly)How to display data from database

gabedaly 02 Jun, 2011
OK I am trying to learn this but it is difficult. I have read the tutorials and what it sounds like is, in order to display data or auto populate fields from a record in a database I will have to use php code and html. Is this correct? Is there no "behind the scenes" magic that will do this without knowing code?

Ultimately, this is what I hope to accomplish:

I would like my customers to be able to go to my form and insert their account number and last name, then if it is in the database, have all of their info (name,address,balance,charges,etc) automatically show up. Then I would want them to have the option to make a payment, request additional service, etc without them having to enter all of their info again.

I can load data into the database pretty easily but getting it out and displaying it is where I am stuck.
Max_admin 03 Jun, 2011
Hi gabedaly,

Getting the data out of the database is done behind the scenes, but to display it you need to use the code, there is no way the form can expect which fields you want to display or how you want your page formatted!

But if you are loading a 1 record only per customer AND if your form fields names match the columns names loaded then you should not need to use or alter any code, this is explained in the "record loader" tutorial.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
gabedaly 04 Jun, 2011

Getting the data out of the database is done behind the scenes, but to display it you need to use the code, there is no way the form can expect which fields you want to display or how you want your page formatted!



I understand that but it would be great if there was another dropdown to select which DB id from the selected table to insert into a particular form field id. Also, if it was possible to insert some DB data into an article through a plugin, that would be way cool and easy to display DB data.

But if you are loading a 1 record only per customer AND if your form fields names match the columns names loaded then you should not need to use or alter any code, this is explained in the "record loader" tutorial.



I going to have to re-read it. But it is a little hard for me to follow on how to only allow a person to view their info. For example the tutorial says insert token in the param field. I think a token is a secret key when a person logs on. Is that correct?

I guess what I would really like to know is, is it possible to do what I am trying to accomplish (first post) without knowing code?
GreyHead 05 Jun, 2011
Hi gabedaly,

What you describe is not difficult to do with ChronoForms, but it's not dead simple either.

Can you do it without knowing any PHP or MySQL - IMHO probably not.

Bob
gabedaly 05 Jun, 2011
That's what I was thinking also Bob. I guess I really need to learn some basics of coding but that takes time and patience and both are hard to come by. It's just that CF is so close to doing all of these things right out of the box without requiring a user to know code. Can anyone point me in the right direction to find some code snipets (maybe with explanations) that can be copied and pasted right into CF that can pull and display the data from the database?

Sincerely, thanks for your help guys!

Gabe
GreyHead 10 Jun, 2011
Hi Gabe,

The DB Record Loader will do most of the work for you. There is a tutorial in the downaloads area here I think.

Bob
gabedaly 10 Jun, 2011

The DB Record Loader will do most of the work for you. There is a tutorial in the downaloads area here I think.



Thanks for the reply. There is a tutorial but I just don't understand had to pass the "token" or any request param value to DB recoed loader. I think token only works if a request was sent via email???

Gabe
gabedaly 12 Jun, 2011
Finally after many days and hours of searching these forums, my form now auto populates the fields with only the registered users info.

Put this code in the "WHERE" box of the DB Record Loader and leave the db field or request param blank. It works!

<?php
$user = &JFactory::getUser();
echo "cf_user_id = ".$user->id
?>
gabedaly 12 Jun, 2011
OK so now I have a snag.

This will work but only if I set the auto login under the settings tab of the Joomla registration to yes.

If is set auto login to no then I have a cf_user_id of 0 and it doesn't work even after i log in.

Any ideas?
This topic is locked and no more replies can be posted.