Forums

security and connecting to tables

cjmicro 11 Dec, 2008
Hi, my programmer and i are working on a form. She is not familiar with joomla and we had some questions.

Do we need the joomla security statement on our form php, the "access or die". I am thinking not, that since it's in CF it handles that part.

We are going to access a table in the same joomla db, but not a jos_ table, it will be a table we added. Is it best to add it via CF (I am only on joomla 1.0 and CF 2.3.9 btw) or can we add the table manually?

Then how do we get the form to access the table's data and pass it through to the form? I don't mean the actual php but just how to get the php to access the new table. I hope this makes sense and I'm not missing something simple!

Thanks,
Cheryl
GreyHead 11 Dec, 2008
Hi Cheryl,

No, you don't need "access or die", this code will be called from a page that already has it.

Make the table a jos_somenameorother table, then you can use the Joomla DB code to access it. You can create it however is easiest. I'd probably do it in MySQL Query Browser but any MySQL tool will do fine.

I'm assuming here that this is 'just' a table that you want to get info from?? If it is then you an write the Joomla db code into the form html (there are many examples here in the forums). If you need to write form data to it, then it's probably better to create it in ChronoForms, you can add extra columns if you need to.

Bob
cjmicro 11 Dec, 2008
<<I'm assuming here that this is 'just' a table that you want to get info from?? If it is then you an write the Joomla db code into the form html (there are many examples here in the forums).>>

This is exactly what we need. We can maintain the table in phpmyadmin directly, so dont' need to write to the db, just read from it. Also once that happens, we need to do some javascript TO it (calculation), and that seems to be another issue we can't figure out. Any suggestions?

I looked but can't find any reference to the Joomla db code you are mentioning. Please let me know where I can find more info on this.

Thank you, as always, for the most prompt, best forum of any component I use!!! (and I'm not just saying that to butter you up!!) 😀

Cheryl
GreyHead 12 Dec, 2008
Hi Cheryl,

Flattery will get you everywhere ;-)

Here's an edited snippet from a recent posting. In this case looking up an entry using the user id
<?php
$db =& JFactory::getDBO();
$my = JFactory::getUser();
$query = "
    SELECT * 
        FROM #__chronoforms_CV_Registration 
        WHERE cf_user_id = ".$db->Quote($my->id).";";
$db->setQuery( $query );
$contact = $db->loadObjectList();
?>
NB not tested and may need de-bugging.

Why do you need to process with JavaScript - can't that do done server side in PHP before you display the form? If it has to be client-side then JavaScript is fine - you need to watch the form name and put the code in the JS box.

Bob

Bob
cjmicro 12 Dec, 2008
Thanks Bob, I think that is exactly what she was looking for the jfactory stuff. Do you know if there is a place where this type of joomla coding is listed, maybe the joomla developer area. like the mos stuff (I see it on things but don't really know what it all is).

Also, the calculation is done based on what a person checks (remember the class registration), so if they check class a and class b the total of those 2 has to go into the total field. So that makes me think it does get done on client side, and we need the js right?

Hi Cheryl,

Flattery will get you everywhere



I'll be back with more questions too, I'm sure. But since you are so brilliant and wonderful I'm sure that won't be a problem.
😛 🤣

I am much more of a designer than a programmer, so let me know if there is anything I can do for you, graphics etc.

Thanks!
Cheryl
GreyHead 12 Dec, 2008
Hi Cheryl,

There is the Joomla 1.5 API here which is te most complete reference but it can be difficult to find stuff unless you know exactly what you are looking for. The Developer Wiki here has links to that and other stuff and is gradually filling out - but still very patchy.

Yes, JavaScript for doing client-side calculations - should be pretty straightforward to add up a few boxes. Someone's posted a script for that today.

Thanks for the design offer . . . :-)

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