Inserting and retrieving hindi text in mysql

1,644 views
Skip to first unread message

Abhishek Singh

unread,
Sep 20, 2013, 3:09:46 AM9/20/13
to xamp...@googlegroups.com
Hello Sir and friends,
    
         This is very urgent. I want to stor and retrive hindi font by submitting through form. I have use utf8_unicode_ci. and ut_general_ ci collation but not working .
       In form , I am typing using kruti dev 010. It type in hindi but in db and retriev page it shown as typing in english alphabate.


Thanks 

Abhishek Singh

Ram Janam

unread,
Sep 21, 2013, 1:31:26 AM9/21/13
to xamp...@googlegroups.com
Hello,
You can use google translator for this job, first type your sentences and then convert it with GT in hindi then copy and paste it in your form and submit. It will work correctly
 


--
Ask New Question from : https://groups.google.com/forum/?fromgroups#!newtopic/xamppdev
 
Create filter of mails from this group http://www.wikihow.com/Create-a-Filter-in-Gmail
---
You received this message because you are subscribed to the Google Groups "PHP Developers' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xamppdev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xamppdev/CACSs2Kj7OPdgdhCqC-yR0aEABnOWEKycpUnDWfxpeVzt9WGPHg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Ramjanam

PRASANT KUMAR SUMAN

unread,
Sep 21, 2013, 7:47:54 AM9/21/13
to xamp...@googlegroups.com
Hi Abhisekh,

You are using UTF-8 to store hindi or any Non-Ascii character. So when
you make connection to mysql you should specify Mysql that you want
UTF-8 charset.

For this you have to use mysql_set_charset()function when you make connection

and before query db table user this mysql_query("set names 'utf8'");

For detail you can visit below links in details
http://akrabat.com/php/utf8-php-and-mysql/
http://stackoverflow.com/questions/2159434/set-names-utf8-in-mysql
> *Ramjanam*
>
> --
> Ask New Question from :
> https://groups.google.com/forum/?fromgroups#!newtopic/xamppdev
>
> Create filter of mails from this group
> http://www.wikihow.com/Create-a-Filter-in-Gmail
> ---
> You received this message because you are subscribed to the Google Groups
> "PHP Developers' Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to xamppdev+u...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/xamppdev/CAH329-YdzTus1yLHmx%2BmPq4wvXC_inuUmX%2BZ2ttJ7QJ%2BsYc4Jg%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>


--


*ℙґα﹩@η☂ Ḳüღαґ $üмαη*
Mob:- 08010173356

Anil Kumar

unread,
Sep 23, 2013, 12:35:34 AM9/23/13
to xamp...@googlegroups.com
Hello,
use this
mysql collection type: utf8_bin
before write 
mysql_query('SET character_set_results=utf8');
mysql_query("select * from tablename")
then display hindi text.


Abhishek Singh

unread,
Sep 24, 2013, 1:31:03 AM9/24/13
to xamp...@googlegroups.com
thanks to all ,

But i tried utf8_bin, utf8_general_ci but not working, actually my client have admin panel he is typing in kruti dev font but it stores in table like what he type english alphabate 


Ram Janam

unread,
Sep 25, 2013, 1:57:39 AM9/25/13
to xamp...@googlegroups.com
Hello Abhishek,


use this following script i think it will solve your problem. I test this is working right.


<?php
if(isset($_POST['submit'])){
    echo "<pre>"; print_r($_POST); die;
}

?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Testing</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
   <!-- <script type="text/javascript" src="https://www.google.com/jsapi"></script>-->
    <script type="text/javascript" src="api.js"></script>
        <script type="text/javascript">
    // Load the Google Transliterate API
    google.load("elements", "1", {
          packages: "transliteration"
        });
    function onLoad() {  
    var options = {
        sourceLanguage: 'en',
        destinationLanguage: ['hi'],       
        transliterationEnabled: true
      }; 
   
    var control = new google.elements.transliteration.TransliterationControl(options);
    var ids = [ "first_name", "last_name", "comm" ];
    control.makeTransliteratable(ids);
    }
    google.setOnLoadCallback(onLoad);
    </script>
</head>
<body>
<form name="frm" action="" method="post">

<table width="30%" style="border:1px solid #06F;background-color:#CFC" align="center">
<tr> <td colspan="2" align="center">Working Demo :</td></tr>
<tR>
    <td>First Name:</td>
        <Td><input type="text" name="first_name" id="first_name"></Td>
    </tR>
    <tR>
    <td>Last Name:</td>
        <Td><input type="text" name="last_name" id="last_name"></Td>
    </tR>
   
    <!--<tR>
    <td>Comment:</td>
        <Td><textarea name="comm" id="comm"></textarea></Td>
    </tR>-->
   
    <tR>
      <Td colspan="2" align="center"><input type="submit" name="submit" value="Submit"></Td>
    </tR>
</table>
</form>
</body>





For more options, visit https://groups.google.com/groups/opt_out.



--
Ramjanam

Ram Janam

unread,
Sep 25, 2013, 1:59:34 AM9/25/13
to xamp...@googlegroups.com
Hello Abhishek,

this is the js file used in above script.



--
Ramjanam
api.js
Reply all
Reply to author
Forward
0 new messages