# |
Dec 19th 2017, 14:26 |
helloworld_ |
thanks, paul_83uk. Ill try it out. |
# |
Dec 19th 2017, 14:21 |
hmic |
paul_83uk: maybe. but you probably better pass the value to where you need it in the first place |
# |
Dec 19th 2017, 14:20 |
paul_83uk |
@hmic is it possible to get the value of the other param out of the Query first? one where is a datetime field that I want to remove the other is a string value but I don't know the value so need to get that value to be included in the new query |
# |
Dec 19th 2017, 14:18 |
paul_83uk |
yeah if that's the correct assignment then out of a foreach loop if you need the value you simply call $showrooms['savoirOwned'][29] // this would give you "row6" |
# |
Dec 19th 2017, 14:18 |
hmic |
paul_83uk: no. you need to build up a new query, once it's executed. |
# |
Dec 19th 2017, 14:15 |
helloworld_ |
like an associative array? |
# |
Dec 19th 2017, 14:15 |
helloworld_ |
$showrooms = array( "savoirOwned" => array( 1 => "row1", 3 => "row2", 4 => "row3", 24 => "row4", 27 => "row5", 29 => "row6", 34 => "row7", 36 => "row8", 37 => "row9" ) ); |
# |
Dec 19th 2017, 14:14 |
helloworld_ |
would i be able to |
# |
Dec 19th 2017, 14:14 |
helloworld_ |
so paul_83uk, |
# |
Dec 19th 2017, 14:07 |
paul_83uk |
$showrooms = array( "savoirOwned" => array( 1 => "row1", 2 => "row2", 3 => "row3", 4 => "row4", 5 => "row5", 6 => "row6", 7 => "row7", 8 => "row8", 9 => "row9" ) ); foreach( $showrooms['savoirOwned'] as $index => $row) { echo $index . ' is ' . $row; } |
# |
Dec 19th 2017, 14:03 |
paul_83uk |
@helloworld if your array is simply "row1", "row2", "row3" then you could either add a "row0" or +1 to the index each time you need to echo it out or -1 when you need to reference it. if the numbers jump then you need to set the key value for the array in the first place. |
# |
Dec 19th 2017, 14:01 |
paul_83uk |
I have a quick question about Cake 3 Query. I have a Query with 2 where clauses. if the ->count() == 0 I want to remove one of the where clauses and run the query again. Is this possible to remove a where clause once set? |
# |
Dec 19th 2017, 14:01 |
helloworld_ |
joop, it's still just iterating 0, 1, 2, 3 |
# |
Dec 19th 2017, 13:58 |
paul_83uk |
I'm guessing your not creating the array? if you are you could simply do [1 => 1, 3 => 3, 24 => 24....] |
# |
Dec 19th 2017, 13:58 |
joop |
$index will be your index and showroms will be your value |
# |
Dec 19th 2017, 13:57 |
joop |
use $index=>showrooms insted of $showroms[$i] => $val |
# |
Dec 19th 2017, 13:55 |
helloworld_ |
basically I want rows to correspond to the showroms number |
# |
Dec 19th 2017, 13:54 |
helloworld_ |
if i have $index in the loop |
# |
Dec 19th 2017, 13:54 |
helloworld_ |
and it's giving 0, 1 ,2 3 |
# |
Dec 19th 2017, 13:54 |
helloworld_ |
i used as $index => $showroms |
# |
Dec 19th 2017, 13:49 |
helloworld_ |
with savoirOwned array inside. |
# |
Dec 19th 2017, 13:49 |
helloworld_ |
$showrooms = array( "savoirOwned" => array( "row1", "row2", "row3", "row4", "row5", "row6", "row7", "row8", "row9" ) ); |
# |
Dec 19th 2017, 13:49 |
helloworld_ |
showrooms is an array |
# |
Dec 19th 2017, 13:45 |
joop |
and if $showrooms is an entity you should use $showroom->savoirOwned |
# |
Dec 19th 2017, 13:44 |
joop |
as $index=>showrooms? |
# |
Dec 19th 2017, 13:44 |
joop |
did you try |
# |
Dec 19th 2017, 13:44 |
helloworld_ |
it would be the value of showroms |
# |
Dec 19th 2017, 13:43 |
helloworld_ |
so that instead of the key being 0, 1, 2, 3 |
# |
Dec 19th 2017, 13:43 |
helloworld_ |
$showroms = [1, 3, 4, 24, 27, 29, 34, 36, 37]; foreach($showrooms["savoirOwned"] as $showroms[$i] => $val){ |
# |
Dec 19th 2017, 13:42 |
helloworld_ |
how do I reference showroms as the keyvalues in this loop? |
# |
Dec 19th 2017, 13:42 |
helloworld_ |
Hi, I need help with using a value of a key value of an array outside of a foreach loop. |
# |
Dec 19th 2017, 13:30 |
veve |
I'm not 100% sure but the problem seems to be related with the php's version (7.2 in my case). On a server with Php 7.0 I don't have any error message |
# |
Dec 19th 2017, 13:13 |
veve |
even without the count, I still get the errors |
# |
Dec 19th 2017, 13:13 |
hmic |
just remove your anyways not implemented error case |
# |
Dec 19th 2017, 13:12 |
hmic |
veve, count is not working as you think |
# |
Dec 19th 2017, 13:11 |
veve |
Does it says something to someone ? |
# |
Dec 19th 2017, 13:10 |
veve |
Hello, I have something very strange. I'm developping a shell in CakePhp 3. In this shell I need to get the last record of a table according to the table's ID. I got it but I get many many error messages before it. My code is here: https://pastebin.com/kEJwDvWJ |
# |
Dec 19th 2017, 13:10 |
ksandeep_ |
now how to format data, Not found any example on it for 3.x |
# |
Dec 19th 2017, 13:09 |
ksandeep_ |
like a users can have multiple addresses, and while adding user, user can add multiple address with add more option |
# |
Dec 19th 2017, 13:08 |
ksandeep_ |
Hi frnds, What is best way to add relation table data with add more option. Every time send request on server and built Html or use sample data and make required update |
# |
Dec 19th 2017, 12:51 |
dereuromark |
Please check your ticket |