I need to extract random records through the order by rand () function, how can i do it?
Forums
random extraction from db
Hi mcasamassima,
Which version you are using ?
Best regards,
Max
Which version you are using ?
Best regards,
Max
I'm using the latest version of ccv5
Hi mcasamassima,
Do you have the SQL syntax to do that ?
Best regards,
Max
Do you have the SQL syntax to do that ?
Best regards,
Max
Hi, the syntax is select field from table where cond order by rand().
Thanks
Michele
Thanks
Michele
Hi Michele,
Please try to use this code in the order by:
Best regards,
Max
Please try to use this code in the order by:
<?php
return array("rand()");
Best regards,
Max
i receive this error
"1305 - FUNCTION operatori_economici_incarichi.rand does not exist"
Thanks Mike
"1305 - FUNCTION operatori_economici_incarichi.rand does not exist"
Thanks Mike
Hi Mike,
Try this then:
Best regards,
Max
Try this then:
<?php
return array(mt_rand() / mt_getrandmax());
Best regards,
Max
Unfortunately it does not work...
Hi Mike,
Could you please try this code in the order box then:
dos it work ?
Best regards,
Max
Could you please try this code in the order box then:
<?php
return 0.369500624360052;
dos it work ?
Best regards,
Max
i receive this error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<?`operatori_economici_incarichi`.`php` `operatori_economici_incarichi`.`retur' at line 1
Thanks Mike
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<?`operatori_economici_incarichi`.`php` `operatori_economici_incarichi`.`retur' at line 1
Thanks Mike
Hi Mike,
Then I think you have placed the code incorrectly ?
Bet regards,
Max
Then I think you have placed the code incorrectly ?
Bet regards,
Max
Mistake me, but is it without the "array" right?
I think i only want the form "return array" within the field "order by"
I think i only want the form "return array" within the field "order by"
solved !! You have to put two points ahead!
in the order box :
<? Php
Return array (": rand ()");
?>
in the order box :
<? Php
Return array (": rand ()");
?>
Good morning, I would like to take this topic. I need to create a lottery system, I have a database like this: ID, NAME, REGISTRATION.
I would like to return this data randomly, based on ID for example.
There will be five draws, so I need the data that is drawn to be repeated, how can I do that?
I'm using CC6
I would like to return this data randomly, based on ID for example.
There will be five draws, so I need the data that is drawn to be repeated, how can I do that?
I'm using CC6
Thanks for the contact, but I have no idea how to resolve this.
Please, I need to resolve this.
Hi Rafael,
In the "read data", set the "select type" to "first matching record", then write the following code in the "offset" box:
In the "read data", set the "select type" to "first matching record", then write the following code in the "offset" box:
{var:random}Now add a "PHP" function, set the name to "random" and write this code:
return rand(0, 9); //assuming you have 10 records in the tableBest regards
I did exactly as you said, but only returns the 1st ID.
Here are pictures of how it is
https://imgur.com/a/kkRRZ
Here are pictures of how it is
https://imgur.com/a/kkRRZ
Hi Rafael,
Did you call the PHP function before calling the "Read data" in your event ?
Best regards
Did you call the PHP function before calling the "Read data" in your event ?
Best regards
I made that change and it's working now, thank you very much.
But, you still have two doubts
1 - How do not show a value that has already been "drawn"?
2 - How to display 5 "draws" (5 lines) at the same time?
But, you still have two doubts
1 - How do not show a value that has already been "drawn"?
2 - How to display 5 "draws" (5 lines) at the same time?
I was able to read the data randomly using an "x" table, now it needs to be different from data and saved in the "y" table, how can I do that?
I'm sorry for my English, I'm brazilian
I'm sorry for my English, I'm brazilian
Good afternoon, I've been able to solve these problems.
Now I need to know how to improve a loading screen. When clicking a button and displaying a loading screen, so it's just a matter of design
Now I need to know how to improve a loading screen. When clicking a button and displaying a loading screen, so it's just a matter of design
How to use "Task Button" or anywhre butom for loading screen or popup information?
Hi rafael,
The question is not clear, please give an example ?
Best regards
The question is not clear, please give an example ?
Best regards
Hi Rafael,
The "Link" view has a dynamic setting which can be used to open a modal with dynamic content!
Best regards
The "Link" view has a dynamic setting which can be used to open a modal with dynamic content!
Best regards
This topic is locked and no more replies can be posted.