dreamincodehamza's Profile User Rating: -----

Reputation: -12 Disgraced
Group:
Contributors
Active Posts:
348 (0.14 per day)
Joined:
12-September 08
Profile Views:
15,776
Last Active:
User is offline Jul 01 2015 06:59 PM
Currently:
Offline

Previous Fields

Country:
PK
OS Preference:
Linux
Favorite Browser:
Safari
Favorite Processor:
Intel
Favorite Gaming Platform:
Playstation
Your Car:
Honda
Dream Kudos:
75

Latest Visitors

Icon   dreamincodehamza has not set their status

Posts I've Made

  1. In Topic: Recursion help

    Posted 1 Jul 2015

    able to find out here is the code i hope it helps anyone
    function get_cat_selectlist($current_cat_id, $count) 
    {
    
      static $option_results;
      // if there is no current category id set, start off at the top level (zero)
      if (!isset($current_cat_id)) {
        $current_cat_id =0;
      }
      // increment the counter by 1
      $count = $count+1;
                     // database
                     $this->CI = &get_instance(); 
                     $this->CI->db->select('cat_id, cat_name');
      $get_options = $this->CI->db->get_where('tblcatagory', array( 'parent' =>  $current_cat_id) );
    
      $num_options = $get_options->num_rows();
    
    
      // our category is apparently valid, so go ahead 
      if ($num_options > 0) {
        
          foreach ($get_options->result() as $row)
          {
              // if its not a top-level category, indent it to
              //show that its a child category
    
              if ($current_cat_id!=0) {
                $indent_flag =  '--';
                for ($x=2; $x<= $count; $x++) {
                  $indent_flag .=  ' |_ ';
                }
              }
    
    
              if (isset($indent_flag)) 
              {
               $row->cat_name = $indent_flag.$row->cat_name;
              } else {
                $row->cat_name = $row->cat_name;
              }
    
              $option_results[$row->cat_id] = $row->cat_name;
              // now call the function again, to recurse through the child categories
              $this->get_cat_selectlist($row->cat_id, $count);
        }
      }
      return $option_results;
    }
    
  2. In Topic: php mail issue

    Posted 1 Jul 2015

    View Postno2pencil, on 01 July 2015 - 04:42 AM, said:

    Just noticed that you are using the php mail function to send email from a yahoo address. This is likely to be flagged as spam as your server is not going to resolve to yahoo when checked for verification. it is possible that the email alone goes through, but when you start adding an attachment, it's enough to spam out.

    The php mail function works best when using the email from php.ini. If you want to use another domain, it's best to authenticate with that mail server, rather than forging the headers. Even if it were to work, you wouldn't know for how long, until it started spamming out.


    I am using phpmailer.
    using mail() just for testing and it is working fine.
    the problem is with phpmiler.
  3. In Topic: Recursion help

    Posted 1 Jul 2015

    View Postpirulo259, on 01 July 2015 - 07:32 AM, said:

    Try this...

    /**
       *  function start
       * @param type $parent_id
       * @return string
       */
      function getTree_select1($parent_id = 0, $line = '') {
            $this ->iteration_number++;
            
            $first_level = $this->CI->db->get_where($this->table,array('parent_id' => $parent_id))-> result();
            // echo $this->CI->db->last_query();
    
    
            if($this->iteration_number == 1)
                $tree = '<select id="red" class="' . $this ->ul_class . '">';
            else {
                $tree = ''; 
                $line='&nbsp; --';
            }
              
    
    
            foreach ($first_level as $fl) {
                $this -> CI -> db -> where('parent_id', $fl -> category_id);
                $childrens = $this -> CI -> db -> count_all_results($this -> table);
                
                // children check
                if ($childrens == 0) 
                { 
                    // echo $fl->category_name;   
                    // echo $tree ;                 
                    // exit;               
    
                    // no/zero childrens
                    $tree .= '<option value="'.base_url().'categories/sub/'.str_replace(' ', '-', $fl -> category_name).'" cat_id="'.$fl -> category_id.'" >' .$line. $fl->category_name . '</option>';
                } else {
    
                    // one or more childrens
                    $tree .= '<optgroup label="'. $fl->category_name . '" />';
                    $tree .= $this->getTree_select1($fl->category_id);
    				$tree .= '</optgroup>';
                }
                
            }
            $tree .= '</select> ';
            return $tree;
      }// #foreach
    
    



    no luck one parent is out of select list
    here is my db structure
    
    CREATE TABLE IF NOT EXISTS `categories1` (
      `category_id` int(4) NOT NULL AUTO_INCREMENT,
      `category_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
      `category_description` varchar(500) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
      `parent_id` int(4) NOT NULL,
      PRIMARY KEY (`category_id`),
      KEY `categories_categories_fk_idx` (`parent_id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
    
    --
    -- Dumping data for table `categories1`
    --
    
    INSERT INTO `categories1` (`category_id`, `category_name`, `category_description`, `parent_id`) VALUES
    (1, 'category1', 'asfs', 0),
    (2, 'category2', 'asfs', 1),
    (5, 'category3', 'asfs', 1),
    (7, 'category4', 'asfs', 5),
    (8, 'category5', 'asfs', 0);
    
    


    here is the output I am getting with above modificed code

    <br><select id="red" class="treeview"><optgroup label="category1" /><option value="http://localhost/codeigniter3/categories/sub/category2" cat_id="2" >category2</option><optgroup label="category3" /><option value="http://localhost/codeigniter3/categories/sub/category4" cat_id="7" >category4</option></select> </optgroup></select> </optgroup><option value="http://localhost/codeigniter3/categories/sub/category5" cat_id="8" >category5</option></select> 
    
  4. In Topic: php mail issue

    Posted 30 Jun 2015

    View PostArtificialSoldier, on 29 June 2015 - 10:02 AM, said:

    If the mail server isn't accepting the message for delivery then there's going to be an error message in the mail server's log file saying what the problem is. If you don't have access to that file then ask your host to look up the messages for you.



    it is sending normal email with php mail funcion if there is a mail server block then it will not send any mail.right?
  5. In Topic: php mail issue

    Posted 27 Jun 2015

    View Postastonecipher, on 27 June 2015 - 04:35 PM, said:

    And your authentication code is where? You need a username, password, Skype server, port, encryption type. It does not work like the default.


    i am testing this code online on hosting.so i thing i don't need any authentication code i guess.

My Information

Member Title:
D.I.C Regular
Age:
30 years old
Birthday:
October 28, 1984
Gender:
Interests:
internet surfing and football , cricket
Programming Languages:
Php ,
html ,
javascript
css,
php frameworks,
seo

Contact Information

E-mail:
Private
Website URL:
Website URL  http://

Comments

dreamincodehamza has no profile comments yet. Why not say hello?