Jump to content

linux1880

Members
  • Posts

    136
  • Joined

  • Last visited

Everything 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. Hi friends i have latest rss news feed im my php site, i would like to share latest 5 rss feed so some of our partners can publish in thier site . How to do it ?
  4. hi all, i did setup a development server where we can upload php scripts in a network, the problem is script gets error cannot access database although all the db settings are correct pls help
  5. 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>
  6. how to set default controller in codeigniter based on cookie value ?
  7. Thanks a lot , it is working for single question, bot not when i have multiple questions and answers. Could you pls give me a hint what am i missing ? Thanks
  8. 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 ?
  9. I have written a voting script where we can view a total number of votes per choices ? How do i show the voting result as percentage ?
  10. Thanks suresh, I really appreceate for your help for my little knowledge, what if i have to keep track of votes for multiple questions ? above sounds fantastic for single question , or am i missing something ?
  11. 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
  12. how do i pass multiple function in codeigniter uri segment in controler/method like index.php?cat=2&action=edit&group=3&viz=blah
  13. 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>
  14. is this javascript object or function ? var test = { name: 'me', age: 23, parent: function(){ var x = 'sabai'; return x; }, }; document.write(test.parent());
  15. 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>
  16. hi friends i want some jquery code which will show and hide about 5 items in a flashing ways. Thanks
  17. 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); }
  18. I would like to show the categories first when clicked show the related photos.
  19. 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`) )
  20. Thanks adam, what is you best suggestion for making a file name unique ?
  21. Thank you adam, I was also trying to add mysql_insert_id() at the beginning of the file it didn't work for some reason. Could anyone please show me ? Thanks
  22. hi friends i have parameterised the query by doing $sql = "INSERT INTO members(fullname,photo) VALUES(?,?); $stmt = $link->prepare($sql); $stmt->bind_param('ss',$fullname,$photo); $stmt->execute(); Can anyone guide me how to restrict file type ? Many thanks
  23. Thanks all, as far as i believe mysqli(improved) don't need mysql_real_escape_string and addslashes. I would appreceate if anyone would help me to sanitize file types. Thanks
  24. could anyone pls give me code to validate mimetype in the above script? Thanks
×
×
  • 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.