MySQL Query

myfatebiz

Active Member
Hi All,

I'm looking for mysql query it like database join which is it store data as a value but label using another column.

Example:

I have 2 column namely `id` and `question`

Code:
$db = JFactory::getDBO();
$db->setQuery("SELECT `id` FROM `qb_kpp_test` ORDER BY RAND() LIMIT 1");
return $db->loadResult();

I want that `id` label is point column `question`. So result is data store as a `id` but label read as `question`.

Anyone can help? Thanks.

Note: I using calc element for mysql query.

Regards,
MyFateBiz
 
You could use a dbjoin element pointing to qb_kpp_test, value=id, label=question, no "please select",
"Joins where and/or order by statement (SQL)" = ORDER BY RAND() LIMIT 1
 
If i use database join element, it can't read the image files. It only can be read by using MySQL query from calc element.
 

Attachments

  • Database join data look out.png
    Database join data look out.png
    73.2 KB · Views: 182
calc elements wont show a label and store a value.
Not sure what to suggest here - perhaps if the image don't change too often, use the database join element, rendered as either a checkbox or radio list. Then write some custom css to replace the labels with the corresponding image?
 
I tested 50 (question) database join (checkbox) and it can't because load page to long. It take over 20 ++ minute to complete load 50 database join (checkbox). Really scares me.

If i using calc element it only took 6 to 10 sec to load 50 calc element. Just the problem is using calc element straight store what use on select query area.

I wish there have a trick using calc element (mysql query) which is can store as value and view as a label.

Some idea crossed in my mind to modify calc element (calc revolution) if can. Please see the attachment.
 

Attachments

  • Calc Revolution Remake.png
    Calc Revolution Remake.png
    22.3 KB · Views: 178
You can always add a php form plugin to save to/modify the database as you like.

I not understand how php form plugin can be function like store as a value and view as a label? And how to write a code if it possible with php form plugin.

Thanks.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top