Jump to content

linux1880

Members
  • Posts

    136
  • Joined

  • Last visited

Posts posted by linux1880

  1. In my mysql database field the unicode text are like this

     

    काठमाडौà¤, २४ माघ / संविधानसभा सदसà¥à¤¯à¤•à¥‹ रिकà¥à¤¤ ६ सिटका लागि आगामी चैत २८ गते हà¥à¤¨à¥‡
     

     

    But when the above text is outputted in browser it is properly formatted unicode chatracters in my old website. I have written new php 5.3 website and echo the avove text , i get exactly same as above which is unreadable to visitors. I also have header as <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> still no luck.

     

    I am wondering how the above text has rendered correctly on old site and not in new site ? I don't see any special function used in old site either. I am sure someone can help me out on this. Thanks

     

  2. i have a news site and some of my partners want to include latest news. They are doing that with iframe at the moment but they are asking for javascript version so that they can style div, please help me how do i do it in javascript ?

     

    my current script is like this

    <iframe height="30%" width="50%" scrolling="no" frameborder="0" src="http://mysite.com/latestnews.php"></iframe>

  3. I have the code below. I would like to insert value in the middle of array without losing any value or original arrays that are comeing from db tables. For example i want to put adverts after 3rd row. How do i achieve it pls help

     

             <table width="95%" border="0" cellspacing="0" cellpadding="0" class="programs">
        				
        <?php foreach($albums as $k => $v){
        	
        		echo   $v['title'].'-'.$v['description'].'<br/>';
        			
        		} ?>
             </table>

  4. my controller is

     

    $data['qna'] = $this->Ivote_model->get_qa();

     

    view

     

    foreach($qna as $k=>$v){
        echo $v['question']. '<br/>';
            echo '-' .$v['answer'] . '<br/>';

     

    model

    function get_qa(){
        $data = array();
        $this->db->select('*');
        $this->db->where('v_questions.id',1);
        $this->db->from('v_answers');
        $this->db->join('v_questions','v_questions.id = v_answers.question_id');
    
        $q = $this->db->get();
    
        if($q->num_rows > 0){
            foreach($q->result_array() as $row){
                $data[] = $row;
            }
        }
        $q->free_result();
        return $data;
    }

     

    my html page shows

     

    What is your favorite food?
    -Sushi
    What is your favorite food?
    -Burgers
    What is your favorite food?
    -kodo
    

    what i want is

     

    What is your favorite food?
        -Sushi
        -Burgers
        -koddo

     

    please help me how do i achieve that ?

     

  5. I am building a poll survey database when user will choose answer from multiple question and before submission he will enter his name and email address.

     

    I woulld like to find the votes based on user, who gave vote to which question.

     

    so far i made 2 tables: question and answer.

     

    questions fields = id, question

    answers fields = id, answer, question_id, votes

     

    Please help me how do i go forward, Thanks

  6. why i am getting b is null error ?

     

    <html>
    <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <title>createelement</title>
    <script type="text/javascript" charset="utf-8">
    
    var b = document.getElementById('clickme'),
    count = 0;
    b.onclick = function () {
    count += 1;
    b.innerHTML = "Click me: " + count;
    };
    
    </script>
    
    </head>
    
    <body>
    
    <button id="clickme">click me </button>
    
    </body>
    
    
    
    
    </html>
    
    
    

  7. i am trying to display result in div but no luck, while it works on alert, pls help

     

    <html>
    <head>
    <script src="jquery.min.js"></script>
    
    </head>
    <body>
    
    <script>
    $(document).ready(function(){
       $("#form1").submit(function(){
    
    	var a = parseInt($("#in1").val());
    	var b = parseInt($("#in2").val());
    	var total = a+b; 
    	$("#total").append("<p>+total+</p>")   
        });
    
    });
    </script>
    
    
    
    
    
    
    <form id="form1">
    num1 <input type="text" id="in1" size=5 /> +
    num2 <input type="text" id="in2" size=5 /> 
    <input type="submit">
    
    
    
    </form>
    
    <div id="total"></div>
    
    
    </body>
    </html>
    

  8. hello friends, can’t understand why this image resizing not working pls help

     

     

    //updating article
        
        function updateArticle(){
        $data = array(
            'a_title'            =>$_POST['a_title'],
            'a_description'        =>$_POST['a_description'],
            'a_flash_news'         => $_POST['a_flash_news'],
            'a_content'            =>$_POST['a_content'],
            //'a_views'             => $_POST['a_views'],
            'a_image_caption'    =>$_POST['a_image_caption'],
            'a_audio_caption'    =>$_POST['a_audio_caption'],
            'a_video'            =>$_POST['a_video'],
            'a_video_caption'    =>$_POST['a_video_caption'],
            'a_channel'             =>$_POST['a_channel'],
            'a_grouping'        =>$_POST['a_grouping'],
            'a_status'            =>$_POST['a_status'],
            'a_breaking'        =>$_POST['a_breaking'],
            'a_hot'                =>$_POST['a_hot'],
            'a_category_id'        =>$_POST['a_category_id'],
            'a_featured'        =>$_POST['a_featured'],
            'a_tags'            =>$_POST['a_tags'],
            'a_author'            =>$_POST['a_author'],
            'a_date'            =>$_POST['a_date']
            );
            
            
            //UPLOAD IMAGE
            //some $config vars for image
            $config['upload_path'] = './images/articles';
            $config['allowed_types'] = 'gif|jpg|jpeg|png';
            $config['max_size'] = '0';
            $config['remove_spaces'] = true;
            $config['overwrite'] = false;
            $config['max_width'] = '0';
            $config['max_height'] = '0';
            
            //for image resize
            $config['image_library'] = 'gd2';
            $config['maintain_ratio'] = TRUE;
            $config['width'] = 320;
            $config['height'] = 320;
            
            $this->load->library('upload', $config);
            $this->load->library('image_lib', $config);
            $this->image_lib->resize();
            //upload main image
            if(!$this->upload->do_upload('a_image')){
                //$e = $this->upload->display_errors();
                //print_r($e);
            }
            
            $image = $this->upload->data();
            if($image['file_name']){
                $data['a_image'] = "images/articles/". $image['file_name'];
            }
            
            
            //UPLOAD THUMBNAIL
            unset($config);
            
            //now upload thumb
            //some $config vars for thumb
            $config['upload_path'] = './images/articles/thumb';
            $config['allowed_types'] = 'gif|jpg|jpeg|png|wav';
            $config['max_size'] = '0';
            $config['remove_spaces'] = true;
            $config['overwrite'] = false;
            $config['max_width'] = '0';
            $config['max_height'] = '0';    
            $this->upload->initialize($config);
            
                if(!$this->upload->do_upload('a_thumbnail')){
                //$e = $this->upload->dispaly_errors();
                //print_r($e);exit();    
            }        
            
            $thumb = $this->upload->data();
                if($thumb['file_name']){
                $data['a_thumbnail'] = "images/articles/thumb/". $thumb['file_name'];
            }
            
            
            //UPLOAD AUDIO
            unset($config);
            
            //now upload thumb
            //some $config vars for thumb
            $config['upload_path'] = './audio';
            $config['allowed_types'] = 'mp3|gif|jpg|jpeg|png|wav';
            $config['max_size'] = '0';
            $config['remove_spaces'] = true;
            $config['overwrite'] = false;
            $config['max_width'] = '0';
            $config['max_height'] = '0';    
            $this->upload->initialize($config);
            
                if(!$this->upload->do_upload('a_audio')){
                //$e = $this->upload->dispaly_errors();
                //print_r($e);exit();    
            }        
            
            $thumb = $this->upload->data();
                if($thumb['file_name']){
                $data['a_audio'] = "audio/". $thumb['file_name'];
            }
    
            //goes at last
            $this->db->where('id',$_POST['id']);
            $this->db->update('articles', $data);
            
        }  
    
    

  9. Hi friends,

     

    I have two mysql db tables, photos and album, I would like to list photos by album how do i do that ?

     

    CREATE TABLE `album` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `album_name` varchar(95) NOT NULL,
    `album_desc` text NOT NULL,
    PRIMARY KEY (`id`)
    );
    
    
    
    CREATE TABLE `photos` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `album_id` int(11) NOT NULL,
    `thumb_name` varchar(255) NOT NULL,
    `photo_name` varchar(250) NOT NULL,
    PRIMARY KEY (`id`)
    ) 
    
    
    

×
×
  • 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.