Jump to content

dreampho

Members
  • Posts

    96
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

dreampho's Achievements

Member

Member (2/5)

0

Reputation

  1. Oh thank you! I can't believe I missed that! Its strange though that others like the item before can be accessed with $data['type']; Any ideas why? Just to fully understand.
  2. @cyberRobot. I have starred at this for ages now and just cannot for the life of me see the issue. Here is my full function: (you'll see $data is passed to the function) public function entry_submission_end($entry_id, $meta, $data) { if ($data['channel_id'] == '4') { $member_id = $meta['author_id']; // Find member group for member $this->EE->db->select('group_id'); $this->EE->db->where('member_id', $member_id); $query = $this->EE->db->get('exp_members'); $member_group = $query->row(); $member_group = $member_group->group_id; $category_id = $data['category'][0]; $type = $data['type']; $portfolio_number = 0; if ($type == '2.0') { $type = '2'; } else { $type_split = explode(".", $type); $portfolio_number = $type_split[1]; $type = '1'; } $insert = array( 'entry_id' => $entry_id, 'member_id' => $member_id, 'member_group' => $member_group, 'category_id' => $category_id, 'type_id' => $type, 'portfolio_number' => $portfolio_number ); $this->EE->db->insert('exp_submissions', $insert); } } If I print out the $data variable, it shows this: Array ( [RET] => http://www.mydomain.com/account/add-submission [URI] => account/add-submission [XID] => 9c4967c581b38956276d906f84bdd0ea21f3fdaf [return_url] => account/submission-complete/ENTRY_ID [channel_id] => 4 [entry_id] => 0 [ACT] => 4 [meta] => BJ6y4b3z03uiWTtrUJV0Ed+GiBx0qHdfQIyjoMTKwYlIdc6+GXIR2ZafOi1wHEO7TwkV8Vqxa9UHDOfSLGAbqtUDGXBkFWHolOAhGO5815Qy8XEcsVYbAJ6mrt2unT3l0KtjUaY0DtDqkTy5hdlwScNuYXO9IuI4Ts/7E3JgZkRUj0j/YNx4upWAgdGCycPNhS7zN8z5BTfhfEmG/HxgSsh2qL8olN0NpN8gcFLbb+26So3sMhs1ePZ4O2eYtREkaT7LY6OOxncMUXJ0SqZgPvexBOsd1bgaZzOJyuOxDW6clpFTeDvaZ08uxT4dmqpBdDuxzX1uPmSGd1z9M/bwLVdksDo1O/Bqa8BS8vb5mCKbJf4g9o5F4uCZ/Yd8zQryYKLnCJaFLw7BAZoQAHKolyOTr3YBSPlHt0eS3xV+B6UwXnmt5fTrZW+E5PYxhrpyNtcDvKur3D6nf0Jl3UE2ArC2ocN3X9RumWynG6eBdsvSErpVVEf9liN41zW7OoEu/dDJdPWfoqm0EpNtPqimXeuKPnUg8uR9qBGwKhpwlbA= [return] => account/submission-complete/ENTRY_ID [site_id] => 1 [submission_file_hidden_file] => [submission_file_hidden_dir] => 1 [type] => 2.0 [snap_utTEbLXYz] => NBePCXPUaVqYN [submission_file] => {filedir_1}name_name_141.jpg [field_id_48] => {filedir_1}name_name_141.jpg [field_ft_48] => none [revision_post] => Array ( [RET] => http://www.mydomain.com/account/add-submission [URI] => account/add-submission [XID] => 9c4967c581b38956276d906f84bdd0ea21f3fdaf [return_url] => account/submission-complete/ENTRY_ID [author_id] => 12 [channel_id] => 4 [entry_id] => 0 [ACT] => 4 [meta] => BJ6y4b3z03uiWTtrUJV0Ed+GiBx0qHdfQIyjoMTKwYlIdc6+GXIR2ZafOi1wHEO7TwkV8Vqxa9UHDOfSLGAbqtUDGXBkFWHolOAhGO5815Qy8XEcsVYbAJ6mrt2unT3l0KtjUaY0DtDqkTy5hdlwScNuYXO9IuI4Ts/7E3JgZkRUj0j/YNx4upWAgdGCycPNhS7zN8z5BTfhfEmG/HxgSsh2qL8olN0NpN8gcFLbb+26So3sMhs1ePZ4O2eYtREkaT7LY6OOxncMUXJ0SqZgPvexBOsd1bgaZzOJyuOxDW6clpFTeDvaZ08uxT4dmqpBdDuxzX1uPmSGd1z9M/bwLVdksDo1O/Bqa8BS8vb5mCKbJf4g9o5F4uCZ/Yd8zQryYKLnCJaFLw7BAZoQAHKolyOTr3YBSPlHt0eS3xV+B6UwXnmt5fTrZW+E5PYxhrpyNtcDvKur3D6nf0Jl3UE2ArC2ocN3X9RumWynG6eBdsvSErpVVEf9liN41zW7OoEu/dDJdPWfoqm0EpNtPqimXeuKPnUg8uR9qBGwKhpwlbA= [return] => account/submission-complete/ENTRY_ID [site_id] => 1 [title] => Test [submission_file_hidden_file] => [submission_file_hidden_dir] => 1 [type] => 2.0 [category] => Array ( [0] => 7 ) [status] => open [snap_utTEbLXYz] => NBePCXPUaVqYN [submission_file] => name_name_14.jpg [field_id_48_hidden_file] => [field_id_48_hidden_dir] => 1 [field_id_48] => name_name_14.jpg [field_ft_48] => none [allow_comments] => y [entry_date] => 1381930740 [previous_status] => ) ) You'll see towards the end, it shows : [category] => Array ( [0] => 7 ) This is what I am trying to access. Thank you. P.S The code is for CMS so thats why some of the code includes 'EE->db' etc.
  3. Hi. I have the following array: array(18) { ["category"]=> array(1) { [0]=> string(1) "1" } } The main array is indexed with $data, so I thought $data['category'][0]; would do the trick to get the value, but it returns NULL. How is the correct way to access to this value? PS. I am able to access other values through $data when there are not multidimensional arrays.
  4. I am using a PHP variable to enter the entry_ids. WHERE sub.entry_id IN ('$variable') I excluded it to show you the entry ids. With the variable I need the single quotes. Any ideas why I can't get a correct count?
  5. I wasn't familiar with the word 'dump'. -- -- Table structure for table `exp_judging` -- CREATE TABLE IF NOT EXISTS `exp_judging` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `rel_id` int(10) unsigned NOT NULL, `judge_id` int(10) unsigned DEFAULT NULL, `pre` int(10) unsigned DEFAULT NULL, `stage_1` int(10) unsigned DEFAULT NULL, `stage_2` int(10) unsigned DEFAULT NULL, `stage_3` int(10) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=217 ; -- -- Dumping data for table `exp_judging` -- INSERT INTO `exp_judging` (`id`, `rel_id`, `judge_id`, `pre`, `stage_1`, `stage_2`, `stage_3`) VALUES (216, 34, 1, 1, 0, NULL, NULL), (215, 33, 1, 1, 1, 3, NULL), (214, 32, 1, 1, 1, 7, NULL), (213, 36, 1, 1, 1, 1, NULL), (212, 35, 1, 1, 1, 3, NULL), (211, 31, 1, 1, 1, 2, NULL), (210, 30, 1, 1, 1, 1, NULL); -- -------------------------------------------------------- -- -- Table structure for table `exp_submissions` -- CREATE TABLE IF NOT EXISTS `exp_submissions` ( `id` int(11) NOT NULL AUTO_INCREMENT, `entry_id` int(10) NOT NULL, `member_id` int(10) NOT NULL, `member_group` int(10) NOT NULL, `category_id` int(10) NOT NULL, `type_id` int(10) NOT NULL, `portfolio_number` int(10) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=70 ; -- -- Dumping data for table `exp_submissions` -- INSERT INTO `exp_submissions` (`id`, `entry_id`, `member_id`, `member_group`, `category_id`, `type_id`, `portfolio_number`) VALUES (30, 342, 1, 5, 2, 2, 0), (31, 343, 1, 5, 1, 1, 2), (32, 344, 1, 6, 1, 1, 1), (33, 345, 1, 6, 1, 1, 1), (34, 346, 1, 6, 2, 1, 1), (35, 353, 1, 5, 1, 1, 2), (36, 354, 1, 5, 1, 1, 2), (37, 358, 1, 1, 1, 2, 0), (38, 359, 1, 1, 1, 2, 0), (39, 360, 1, 1, 1, 2, 0), (40, 361, 1, 1, 1, 2, 0), (41, 362, 1, 1, 1, 2, 0), (42, 363, 1, 1, 1, 2, 0), (43, 364, 1, 1, 1, 2, 0), (44, 366, 1, 1, 1, 2, 0), (45, 367, 1, 1, 1, 2, 0), (46, 368, 1, 1, 1, 2, 0), (47, 369, 1, 1, 1, 2, 0), (48, 370, 1, 1, 1, 2, 0), (49, 372, 1, 1, 1, 2, 0), (50, 373, 1, 1, 1, 2, 0), (51, 375, 1, 1, 1, 2, 0), (52, 379, 1, 1, 1, 2, 0), (53, 380, 1, 1, 1, 2, 0), (54, 381, 1, 1, 1, 2, 0), (55, 382, 1, 1, 1, 2, 0), (56, 384, 1, 1, 1, 1, 2), (57, 385, 1, 1, 1, 1, 2), (58, 386, 1, 1, 1, 1, 2), (59, 387, 1, 1, 1, 1, 3), (60, 388, 1, 1, 1, 1, 3), (61, 389, 1, 1, 1, 1, 3), (62, 390, 1, 1, 1, 1, 3), (63, 391, 1, 1, 1, 1, 3), (64, 392, 1, 1, 1, 1, 3), (65, 393, 1, 1, 1, 1, 3), (66, 394, 1, 1, 1, 1, 3), (67, 395, 1, 1, 1, 1, 3), (68, 396, 1, 1, 1, 1, 3), (69, 397, 1, 1, 1, 1, 2);
  6. SELECT COUNT(*) AS count_result FROM exp_judging AS jud INNER JOIN exp_submissions AS sub ON jud.rel_id = sub.id WHERE sub.entry_id IN ('342,354,343,353') AND jud.stage_3 IS NULL exp_submissions exp_judging The query should return a count of 4, as all are valid and all have NULL as stage_3. Thank you for your help.
  7. Thank you for your reply. My count keeps returning 1, which is why I thought it was the GROUP BY issue. I have changed to INNER JOIN but it is still returning 1 for the count. I want to count how many rows where the entry_id in exp_submissions is one of the given entry_ids and the filed stage_3 IS NULL in the table exp_judging
  8. Hi. I am trying to count the number of rows returned. I understand that I am supposed to use GROUP BY with COUNT, but I can't with this query as I simply want all rows returned which match the query. Is it possible to COUNT without GROUP BY? Here is my current query. SELECT COUNT(*) AS count_result FROM exp_judging AS jud LEFT JOIN exp_submissions AS sub ON jud.rel_id = sub.id WHERE sub.entry_id IN ('412,413,414,415') AND jud.stage_3 IS NULL Thank you.
  9. @boompa, I have done it, and it outputs: Array ( [0] => 157+0 [1] => 155+1 ) Key: Empty key -- cart_check_row_id: Array ( [0] => 0 [1] => 0 ) Final cart_check_row_id: 0
  10. Okay. I am pretty new to all this, so everything you see as simple is mega complicated to me. I have done this: $cart_check = '157+0,155+1,'; $cart_check = trim($cart_check, ','); $cart_check = explode(',', $cart_check); which outputs this: array(2) { [0]=> string(5) "157+0" [1]=> string(5) "155+1" } Is this what you mean, as its basically what I was already doing isn't it? If not, can you show me how?
  11. Hi mac_gyver. Thank you for your response. Unfortunately its not really my cart. I am using a prebuilt cart so I can't use your suggested way unfortunately. I don't understand why the code isn't working, as I have said in conditions, if there is no data then leave $cart_check_row_id empty, if there is data then check for the number in the array, if its there get the key, if key then set that section of the array to $cart_check_row_id, if no key then create an array with 0's. I can't see how the array is empty, or doesn't have two elements.
  12. Hi. I have built a small script to use in my cart which is run on each page load. I am using AJAX to load this page each time a change is made. The code looks at a string of numbers which change dependant on the items in the cart. In my code below I displayed some example numbers that might appear. The format is always number '+' number ',' Each time the code is loaded, regardless if the $cart_check is empty or not, it shows the php notice 'Undefined offset 1', and I can't figure out why. Can anyone help me understand whats happening here, and possibily how to fix it? $cart_check = '123+0,145+1,134+2,'; $cart_check = trim($cart_check, ','); if ($cart_check == "") { $cart_check_row_id = ''; } else { $cart_check = explode(',', $cart_check); $key = array_search(158, $cart_check); if ($key != "") { $cart_check_row_id = explode("+", $cart_check[$key]); } else { $cart_check_row_id = array( "0" => 0, "1" => 0 ); } $cart_check_row_id = $cart_check_row_id[1]; }
  13. Hi. I am currently removing the currency symbol from my string, which is in this case 'R'. I want to also remove any commas, how can I do this? $deposit = str_replace('R','',$deposit); Thank you.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.