Developers Archive for January, 2007

ROW_COUNT()

ROW_COUNT() Wednesday, January 31st, 2007

ROW_COUNT()

This function used return the number of rows updated, inserted, or deleted by the preceding statement and -1 when no rows affected.

Syntax:
INSERT INTO [table_name] ([field1,field2,…]) VALUES ([val,val2,..]);
SELECT ROW_COUNT();

Example:

INSERT INTO wordlist (keyword,docid) VALUES (’sample1′,123), (’sample2′,124), (’sample3′,125);
SELECT ROW_COUNT();

Wednesday, January 31st, 2007

ON DUPLICATE KEY UPDATE

If inserted row cause a duplicate value in a UNIQUE index or PRIMARY KEY,Then It updated using ON DUPLICATE KEY .

Syntax:
INSERT INTO [table_name] ([field1,field2,…]) VALUES ([val1,val2,..]) ON DUPLICATE KEY UPDATE [val1,val2,..].

Example:

INSERT INTO wordlist (keyword,docid) VALUES (’sample’,3435) ON DUPLICATE KEY UPDATE docid=docid+1

chr

chr Wednesday, January 31st, 2007

chr

chr
- It return a specific character for a given ASCII Value

Synatx:

string chr ( int ascii)

It returns a one-character string containing the character specified

by ascii.

Example:

$str = chr(65);
echo $str

It returns ‘A’.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.