catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.83k stars 1.15k forks source link

BUG #437

Closed KiborgMaster closed 6 years ago

KiborgMaster commented 8 years ago

in version 1.1.2 1) ORDER BY RAND() - does not work 2) Function [SELECT] does not return array value, because i check my query, and [SELECT] must return three value, but he dont return never and PHP answer Warning: Invalid argument supplied for foreach()

catfan commented 8 years ago
  1. Yes, ORDER BY RAND() is not supported, and we don't recommend you to use that for randomizing data.
  2. Would you like to show me the code you used for select()?
KiborgMaster commented 8 years ago

But sumthing my client use RADNOM view. THis is my code, in version Medoo 0.9.8.3 all work very good

$postData = $this->db->select('v'.PREFIX.'short_posts', ['incr', 'incr_cat'], [ 'AND'=>['incr_cat[=]'=>$viewIncrCats, 'lang'=>$lang, 'status'=>'active'], 'ORDER'=>$_dataCat['order_by'].' '.$_dataCat['order_type'], 'LIMIT'=>[ $bLimit, $eLimit ] ] );

foreach($_postData as $value) ........ echo $this->db->last_query() = SELECT "incr","incr_cat" FROM "v_wst_short_posts" WHERE "incr_cat" IN ('5') AND "lang" = 'ru' AND "status" = 'active' ORDER BY "incr" DESC LIMIT 0,10

catfan commented 6 years ago

Check out the new feature raw object https://medoo.in/api/raw.