Jump to content

Xtremer360

Members
  • Posts

    1,444
  • Joined

  • Last visited

Everything posted by Xtremer360

  1. I'm trying to figure out why when it shows the listing of attachments when its not NULL that it displays them as a string and NOT as an array. That way after it checks to see if its a file and returns TRUE for the function then it makes it array after all the attachments have been gone through. $attachments = json_decode($attachments, TRUE); for ($x = 0; $x < count($attachments); $x++) { $file_name = $attachments[$x]; if ($this->functions_model->is_file('assets/downloads/'.$file_name, FALSE) === TRUE) { $message_data->attachments = $file_name; } }
  2. I have no idea but I've tried alerting everywhere in my code and can't find out why its not getting down to my submitHandler. Any ideas? $(window).load(function() { $.validator.addMethod('regexp', function(value, element, param) { return this.optional(element) || value.match(param); }, 'This is not an accepted value!'); var validatelogin = $("form").validate({ invalidHandler: function(form, validator) { var errors = validator.numberOfInvalids(); if (errors) { var message = errors == 1 ? 'You missed 1 field. It has been highlighted.' : 'You missed ' + errors + ' fields. They have been highlighted.'; $('.box .content').removeAlertBoxes(); $('.box .content').alertBox(message, {type: 'warning', icon: true, noMargin: false}); $('.box .content .alert').css({ width: '', margin: '0', borderLeft: 'none', borderRight: 'none', borderRadius: 0 }); } else { $('.box .content').removeAlertBoxes(); } }, showErrors : function(errorMap, errorList) { this.defaultShowErrors(); var self = this; $.each(errorList, function() { var $input = $(this.element); var $label = $input.parent().find('label.error').hide(); $label.addClass('red'); $label.css('width', ''); $input.trigger('labeled'); $label.fadeIn(); }); }, submitHandler: function(form) { var dataString = $('form').serialize(); $.ajax( { type: 'POST', url: 'login/submit', data: dataString, dataType: 'json', success: function(data) { if (data.error == 'TRUE') { $('.box .content').removeAlertBoxes(); $('box .content').alertBox(data.message, { type: 'warning', icon: true, noMargin: false }); $('.box .content .alert').css( { width: '', margin: '0', borderLeft: 'none', borderRight: 'none', borderRadius: 0 }); } else { window.location = '/cpanel/dashboard' } } }); } }); $('#login_form input[name="username"]').rules('add', { required: true, minlength: 6, maxlength: 12, regexp: /^\w+$/ }); $('#login_form input[name="password"]').rules('add', { required: true, minlength: 6, maxlength: 12, regexp: /^\w+$/ }); });
  3. Still having an issue with this. If you notice in the bottom var dump you notice how both of the objects have a news article id of 1 which is the article your viewing which is right. Now the tags associated with it is tag id 1 and tag id of 2. So if you look above those are all the post tags in the database. I need it to take those two post tag ids of 1 and 2 and scroll through the top object and have the post tag with an id of 1 and 2 be checked so according to this the checkbox of Kid Wonder and Oriel should both be checked. I tried the in_array but couldn't find a working solution. news_article_post_tags array(3) { [0]=> object(stdClass)#33 (2) { ["news_article_post_tag_id"]=> string(1) "1" ["news_article_post_tag_name"]=> string(10) "Kid Wonder" } [1]=> object(stdClass)#34 (2) { ["news_article_post_tag_id"]=> string(1) "2" ["news_article_post_tag_name"]=> string(5) "Oriel" } [2]=> object(stdClass)#35 (2) { ["news_article_post_tag_id"]=> string(1) "3" ["news_article_post_tag_name"]=> string(11) "Ryu Satoshi" } } news article index post tags data array(2) { [0]=> object(stdClass)#37 (2) { ["news_article_id"]=> string(1) "1" ["news_articles_post_tag_id"]=> string(1) "1" } [1]=> object(stdClass)#38 (2) { ["news_article_id"]=> string(1) "1" ["news_articles_post_tag_id"]=> string(1) "2" } } s
  4. <?php foreach ($news_article_post_tags as $news_article_post_tag) { if (in_array($news_article_post_tag->news_article_post_tag_id, $news_articles_index_post_tags_data)) { $checked_value = 'checked'; } else { $checked_value = ''; } $data = array('name' => 'news_article_post_tags', 'id' => $news_article_post_tag->news_article_post_tag_id, 'checked' => $checked_value); echo form_label(form_checkbox($data).$news_article_post_tag->news_article_post_tag_name); } ?> I ran a print_r on both arrays and this is the result. Array ( [0] => stdClass Object ( [news_article_category_id] => 1 [news_article_category_name] => Headlines [news_article_posting_permission_name] => Editors and Admins and Webmasters Only ) [1] => stdClass Object ( [news_article_category_id] => 3 [news_article_category_name] => Columns [news_article_posting_permission_name] => Editors and Admins and Webmasters Only ) [2] => stdClass Object ( [news_article_category_id] => 4 [news_article_category_name] => Main News [news_article_posting_permission_name] => Editors and Admins and Webmasters Only ) [3] => stdClass Object ( [news_article_category_id] => 2 [news_article_category_name] => Rumors [news_article_posting_permission_name] => All Users ) ) Array ( [0] => stdClass Object ( [news_article_id] => 1 [news_article_category_id] => 1 ) ) I'm trying to figure out why none of the checkboxes are being checked.
  5. I have the following code that works however I want to add to it. I have another array of values that I want to see if the news_article_category_id exists inside the array and if it is then make the checked value of the checkbox set to checked. How would that be accomplished? <?php foreach ($news_article_categories as $news_article_category) { $data = array('name' => 'news_article_categories', 'id' => $news_article_category->news_article_category_id); echo form_label(form_checkbox($data).$news_article_category->news_article_category_name); } ?>
  6. Issue was that I was using contender3 table alias situation was obviously wrong however te real issue and this is the tricky part is what if one of the values inside of the champion_id or contender1_id or contender2_id or contender3_id has a value of 0 then how would I account for that. If the champion_id is 0 then it should put Vacant into the array and for the contenders if the value is 0 then it should put TBD for each of them.
  7. Perfect I have a working print_r of my resultset however its the wrong desired results. title_champions_table title_id = 1 champion_id = 1 contender1_id = 2 contender2_id = 3 contender3_id = 3 title_id = 2 champion_id = 1 contender1_id = 2 contender2_id = 3 contender3_id = 3 title_id = 3 champion_id = 1 contender1_id = 2 contender2_id = 3 contender3_id = 3 Roster Table roster_id Roster Name 1 - Kid Wonder 2- Oriel 3- Ryu Satoshi Array ( [0] => stdClass Object ( [title_name] => Undisputed Title [title_id] => 1 [champion] => Ryu Satoshi [contender1] => Ryu Satoshi [contender2] => Ryu Satoshi [contender3] => Ryu Satoshi ) [1] => stdClass Object ( [title_name] => Tag Team Titles [title_id] => 2 [champion] => Ryu Satoshi [contender1] => Ryu Satoshi [contender2] => Ryu Satoshi [contender3] => Ryu Satoshi ) ) [2] => stdClass Object ( [title_name] => Outlaw Title [title_id] => 3 [champion] => Ryu Satoshi [contender1] => Ryu Satoshi [contender2] => Ryu Satoshi [contender3] => Ryu Satoshi ) /** * Gets the listing of all title champions and contenders. * * @return mixed (object/NULL) Object of title champions/contenders if query returned any data */ public function get_title_champions() { $database_schema = $this->master_model->database_schema(); $this->db->select($database_schema->titles_table.'.title_name'); $this->db->select($database_schema->titles_table.'.title_id'); $this->db->select('contender3.roster_name AS champion'); $this->db->select('contender3.roster_name AS contender1'); $this->db->select('contender3.roster_name AS contender2'); $this->db->select('contender3.roster_name AS contender3'); $this->db->from($database_schema->title_champions_table); $this->db->join($database_schema->titles_table, $database_schema->titles_table.'.title_id ='.$database_schema->title_champions_table.'.title_id'); $this->db->join($database_schema->roster_table.' AS champion', 'champion.roster_id ='.$database_schema->title_champions_table.'.champion_id', 'inner'); $this->db->join($database_schema->roster_table.' AS contender1', 'contender1.roster_id ='.$database_schema->title_champions_table.'.contender1_id', 'inner'); $this->db->join($database_schema->roster_table.' AS contender2', 'contender2.roster_id ='.$database_schema->title_champions_table.'.contender2_id', 'inner'); $this->db->join($database_schema->roster_table.' AS contender3', 'contender3.roster_id ='.$database_schema->title_champions_table.'.contender3_id', 'inner'); $query = $this->db->get(); return $query->result(); }
  8. You all will probably shoot me but I'm getting a similar syntax error like I did in my other post but not not seeing it. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS champion INNER JOIN `roster` ON `roster`.`roster_id` =`title_champions`.`cont' at line 4 SELECT `titles`.`title_name`, `titles`.`title_id` FROM (`title_champions`) JOIN `titles` ON `titles`.`title_id` =`title_champions`.`title_id` INNER JOIN `roster` ON `roster`.`roster_id` =`title_champions`.`champion_id` AS champion INNER JOIN `roster` ON `roster`.`roster_id` =`title_champions`.`contender1_id` AS contender1 INNER JOIN `roster` ON `roster`.`roster_id` =`title_champions`.`contender2_id` AS contender2 INNER JOIN `roster` ON `roster`.`roster_id` =`title_champions`.`contender3_id` AS contender3 /** * Gets the listing of all title champions and contenders. * * @return mixed (object/NULL) Object of title champions/contenders if query returned any data */ public function get_title_champions() { $database_schema = $this->master_model->database_schema(); $this->db->select($database_schema->titles_table.'.title_name'); $this->db->select($database_schema->titles_table.'.title_id'); $this->db->from($database_schema->title_champions_table); $this->db->join($database_schema->titles_table, $database_schema->titles_table.'.title_id ='.$database_schema->title_champions_table.'.title_id'); $this->db->join($database_schema->roster_table, $database_schema->roster_table.'.roster_id ='.$database_schema->title_champions_table.'.champion_id AS champion', 'inner'); $this->db->join($database_schema->roster_table, $database_schema->roster_table.'.roster_id ='.$database_schema->title_champions_table.'.contender1_id AS contender1', 'inner'); $this->db->join($database_schema->roster_table, $database_schema->roster_table.'.roster_id ='.$database_schema->title_champions_table.'.contender2_id AS contender2', 'inner'); $this->db->join($database_schema->roster_table, $database_schema->roster_table.'.roster_id ='.$database_schema->title_champions_table.'.contender3_id AS contender3', 'inner'); $query = $this->db->get(); return $query->result(); }
  9. It just seems more logical to match the 1 line to the 1000 lines of code as opposed to matching 1000 lines of code to 1 line
  10. Its not the syntax I am accustomed to using and with all my other syntax makes everything look off.
  11. Is there anyway of doing that line without having the {}?
  12. $this->db->select($this->master_model->news_articles_table.'.news_article_id'); $this->db->select($this->master_model->news_articles_table.'.news_article_title'); $this->db->select("DATE_FORMAT(".$this->master_model->news_articles_table.".news_article_posting_date, '%M %D, %Y') AS news_article_posting_date", FALSE); $this->db->select("CONCAT_WS(' ', ".$this->master_model->users_table.".first_name" $this->master_model->users_table.".last_name) AS author", FALSE); $this->db->select($this->master_model->news_article_categories_table.'.news_article_category_name'); $this->db->from($this->master_model->news_articles_table); $this->db->join($this->master_model->users_table, $this->master_model->users_table.'.user_id ='.$this->master_model->news_articles_table.'.news_article_author_id'); $this->db->join($this->master_model->news_article_categories_table, $this->master_model->news_article_categories_table.'.news_article_category_id ='.$this->master_model->news_articles_table.'.news_article_category_id'); $query = $this->db->get(); return $query->result();
  13. $this->db->select("CONCAT_WS(' ', ".$this->master_model->users_table.".first_name" $this->master_model->users_table.".last_name) AS author", FALSE); I'm sorry if I'm being a problem but I honestly don't see the issue. I removed the comma that I think it is.
  14. I work for a living too just overnights. And I have no idea what JFGI means.
  15. I guess I was wrong. I was under the impression that message board forums and a way for others to talk and ask questions and find out why to your questions. My mistake.
  16. Is that even possible? Why would you even say that?
  17. $this->db->select("CONCAT_WS(' ', ".$this->master_model->users_table.".first_name", $this->master_model->users_table.".last_name) AS author)"); Doesn't work either.
  18. $this->db->select("CONCAT_WS(' ', ".$this->master_model->users_table.".first_name,", $this->master_model->users_table.".last_name) AS author", FALSE); Didn't work.
  19. I have a comma in there though. Is it just on the wrong side of the "?
×
×
  • 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.