# |
Jan 12th 2018, 16:09 |
neon1024 |
You should also not use `count()` in a for loop as it causes count to be executed in every iteration |
# |
Jan 12th 2018, 16:08 |
neon1024 |
If your array is JSON, you might struggle to use it in PHP ;) |
# |
Jan 12th 2018, 16:08 |
neon1024 |
<- Click the [+] button and click on the ‘Code or text snippet’ |
# |
Jan 12th 2018, 16:02 |
danishkhan3621 |
How can i run find query to search records from an array : My array is [{"category_id":1},{"category_id":4}] and i'm running query like this for($i=0; $i<count($get_all_categories_p_id); $i++) { $get_all_categories_prd_id = $this->Products->find('all',array('conditions'=>array('category_id IN'=>$get_all_categories_p_id[$i]['category_id']))); $product_List[]=$get_all_categories_prd_id; } |
# |
Jan 12th 2018, 15:34 |
jotpe |
is there any possibility to run composers `post-update-cmd` for _production_ or _development_? |
# |
Jan 12th 2018, 15:22 |
xavier83ar |
ok, thanks! |
# |
Jan 12th 2018, 15:20 |
jota |
then rollback |
# |
Jan 12th 2018, 15:20 |
jota |
got the query |
# |
Jan 12th 2018, 15:20 |
jota |
@xavier83ar use a begin tran. |
# |
Jan 12th 2018, 15:19 |
dereuromark |
without actual params |
# |
Jan 12th 2018, 15:19 |
dereuromark |
debug((string)$query) only shows the query |
# |
Jan 12th 2018, 15:19 |
jota |
You could use a begin trans... without commit. |
# |
Jan 12th 2018, 15:19 |
dereuromark |
This was the issue to it xavier: https://github.com/cakephp/debug_kit/issues/568 |
# |
Jan 12th 2018, 15:18 |
jotpe |
@learningcake: this one is good: https://paulund.co.uk/datetime-php otherwise you can also use Cake's Time Utility: https://book.cakephp.org/3.0/en/core-libraries/time.html |
# |
Jan 12th 2018, 15:15 |
xavier83ar |
I need run a deleteAll() query, and I want to check the query that the orm will run |
# |
Jan 12th 2018, 15:13 |
xavier83ar |
Hi, is there a way of getting the plain sql that the ORM will run without actually running it? |
# |
Jan 12th 2018, 15:12 |
learningcake |
my bad |
# |
Jan 12th 2018, 15:11 |
learningcake |
Thank you. works now |
# |
Jan 12th 2018, 15:04 |
learningcake |
ok |
# |
Jan 12th 2018, 15:03 |
jotpe |
better use a type which fits to the date (e.g. datetime) and compare with a php datetime object |
# |
Jan 12th 2018, 15:02 |
learningcake |
varchar |
# |
Jan 12th 2018, 15:02 |
learningcake |
the column type is var |
# |
Jan 12th 2018, 15:01 |
jotpe |
maybe the mysql column is datetime |
# |
Jan 12th 2018, 15:01 |
jotpe |
What is the _type_ of the mysql date? You could try to find everything and debug the date. Maybe it's in another format? |
# |
Jan 12th 2018, 14:58 |
learningcake |
any help here? |
# |
Jan 12th 2018, 14:52 |
learningcake |
the database table http://prntscr.com/hzhyb9 |
# |
Jan 12th 2018, 14:52 |
learningcake |
https://gist.github.com/charlie4biz/c6dad27f1c70208fd6b8c8f23c32e1eb |
# |
Jan 12th 2018, 14:52 |
learningcake |
Good day guys. Don't know why this is happening. I have in my database table column var of different dates in rows like 2018-Jan-5, 2018-Feb-5,2018-Mar-05 and so on. I tried doing a select from on columns that the date is greater than today (2018-Jan-12). It works but it kip skipping Feb and starts from Mar |
# |
Jan 12th 2018, 14:50 |
jotpe |
and what is the output of WWW_ROOT? You could also try PHP's __DIR__ constant |
# |
Jan 12th 2018, 14:49 |
jota |
What r u working for guys ? |
# |
Jan 12th 2018, 14:49 |
jota |
I could fix it tru bootstrap.php btw. Thk for the comments :slightly_smiling_face: - Its actually a question to kill my doubts. |
# |
Jan 12th 2018, 14:46 |
jota |
yes. I want that, but do it that way however its not working. |
# |
Jan 12th 2018, 14:45 |
alexdd55 |
@neon1024 @dereuromark to mongodb question ealrier this week: i am going with mongoDB and python seems to be the best way to solve this |
# |
Jan 12th 2018, 14:43 |
jotpe |
So you want a constant NEW_DIR? Or don't i get it? `define('NEW_DIR', WWW_ROOT . 'test' . DS);` |
# |
Jan 12th 2018, 14:42 |
leon |
@dereuromark thx. I’ll give it a try. |
# |
Jan 12th 2018, 14:40 |
jota |
intead of that, I would only use NEW_DIR |
# |
Jan 12th 2018, 14:40 |
jota |
that I should avoid to use WWW_ROOT |
# |
Jan 12th 2018, 14:38 |
jotpe |
hm? So what's the exact problem? |
# |
Jan 12th 2018, 14:36 |
jota |
For me too, the thing is, my constant "NEW_DIR" has define on it the " WWW_ROOT . DS . /newDirFolder . DS " |
# |
Jan 12th 2018, 14:34 |
jota |
yup. |
# |
Jan 12th 2018, 14:34 |
jotpe |
well, `WWW_ROOT . 'test' . DS` works for me?! :slightly_smiling_face: |