I have been trying to figure this out for the past 2 hours and to no
avail. :/ So any advice is GREATLY appreciated.
Ok, I have an array that returns data like this (see array below) The
array[0] contains all the votes for one story as well as information
that pertains to that vote, and the array[1] contains vote information
for another story. What I need to do is check is a user_id stored in a
session, is in the array, and then create a boolean array from that.
For example, here I want to check if the user_id is featured in the
first set of data, let's say my user_id is 74. Ok, so it is in the
first set of data, so we set the boolean variable to true. Next I need
to search the second data field for my user_id, 73. It is not featured
here so the value in my array is set to 0. I need an array that
returns values either 1, for true, your user_id was found in the
table, or false, for your user_id was not featured in the table. They
need to be in order of the story too. I'm having trouble one comparing
the two variables against eachother, since the array is very deep, and
two, creating the array on the fly. Any suggestions are recieved with
open arms! Thanks for looking !
Array
(
[0] => Array
(
[0] => Array
(
[id] => 5
[story_id] => 122
[user_id] => 74
)
[1] => Array
(
[id] => 6
[story_id] => 122
[user_id] => 74
)
)
[1] => Array
(
[0] => Array
(
[id] => 7
[story_id] => 123
[user_id] => 74
)
[1] => Array
(
[id] => 8
[story_id] => 123
[user_id] => 74
)
[2] => Array
(
[id] => 9
[story_id] => 123
[user_id] => 74
)
)
)
[1] => Array
(
* => Array
(
[id] => 7
[story_id] => 123
[user_id] => 45
[Story] => storythree
)
)
)
P.S. The reason I am trying to return a boolean array is because they
will set a value in the view in a div tag for the class, like so
<div class="<?php $user ? 'returnedtruecss' : 'returnedfalsecss'; ?>"</
div>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---