Store Urdu in Mysql

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Sohaib
New php-forum User
New php-forum User
Posts: 1
Joined: Fri Dec 23, 2011 5:39 am

Store Urdu in Mysql

Postby Sohaib » Fri Dec 23, 2011 5:47 am

i have tried to insert urdu in Data Base using following code and HTML but i cant get required result.Can any one help me
<?php

@extract($_REQUEST);
$con = mysql_connect("localhost","root","");
mysql_select_db('urdu',$con);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_query('SET character_set_results=utf8');
mysql_query('SET names=utf8');
mysql_query('SET character_set_client=utf8');
mysql_query('SET character_set_connection=utf8');
mysql_query('SET character_set_results=utf8');
mysql_query('SET collation_connection=utf8_general_ci');

if ($_POST['submitForm'] == "yes")
{

$nithi = "INSERT INTO TAMIL set data='$urdu'";
mysql_query($nithi,$con);

}
?>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<form action="" id="frmurdu" name="frmurdu" method="post">
<input type="hidden" name="submitForm" value="yes">
<table>
<tr>
<td>
<input type="text" id="urdu" name="urdu">
</td>
<td>
<input name="image" type="image" src="images/submit.gif" width="82" height="26" />
</td>
</tr>
</table>
</form>

plz plz help me in this matter

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: Store Urdu in Mysql

Postby egami » Fri Dec 23, 2011 6:11 am

The CORRECT MYSQL SYNTAX TO ADD A ROW:

INSERT into {table} (`fieldname1`,`fieldname2`,`fieldname3`) VALUES ('value1','value2','value3')

Ie..
$table = 'myTable';
INSERT INTO $table ('name','age','gender') VALUES ('Bubba',30,'M')

or..
INSERT INTO $table VALUES ('Bubba',30,'M')
--- Albeit this assumes there are only 3 fields in the table.. You must match the column count with the variables in this scenario.


to UPDATE mysql

UPDATE $table SET fieldname=value // This sets the fieldname on EVERY ROW..
UPDATE $table SET `fieldname`='value' WHERE id='$id' // This updates ONLY the ROW with the id of $id

mirzasam
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Sep 30, 2013 5:01 am

Re: Store Urdu in Mysql

Postby mirzasam » Mon Sep 30, 2013 5:03 am

mysql can even tech me how dose it work in urdu


Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 1 guest