Store Urdu in Mysql

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
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

Post by 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

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests