mysql±¨´í
±¨´í£º
/tmp/ccBBJEB8.o: In function `ping_sql':
pingsql.c:(.text+0x7c): undefined reference to `mysql_init'
pingsql.c:(.text+0xe1): undefined reference to `mysql_real_connect'
pingsql.c:(.text+0xff): undefined reference to `mysql_close'
pingsql.c:(.text+0x119): undefined reference to `mysql_connect'
pingsql.c:(.text+0x198): undefined reference to `mysql_real_escape_string'
collect2: ld ·µ»Ø 1
½â¾ö°ì·¨£º
#gcc -o pingsql pingsql.c -lmysqlclient -I/usr/local/mysql/include/mysql/ -L/usr/local/mysql/lib/mysql
Ïà¹ØÎĵµ£º
Mysql Öж¨Òå×ֶκóµÄÊý¾ÝµÄÓô¦£º
int(1)ºÍint(10)ËƺõûÓÐʲô²î±ð£¬¶¼±íʾ×î´óËĸö×Ö½ÚµÄÕûÐÍÊý¾Ý¡£
ÀýÈ綨ÒåÒ»¸öÃû×ÖΪtestµÄ±í:
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
`id` int(1) NOT NULL,
`ids` int(10) default NULL,
`c` char(1) default NULL,
`cs` ......
2009Äê10ÔÂ30ÈÕ ÐÇÆÚÎå 22:53
ÓÃmysql
ÄÚÖú¯Êýת»»ipµØÖ·ºÍÊý×Ö
ÀûÓÃÁ½¸öÄÚÖú¯Êý
inet_aton:½«ipµØַת»»³ÉÊý×ÖÐÍ
inet_ntoa:½«Êý×ÖÐÍת»»³ÉipµØÖ·
³ä·ÖÀûÓÃmysqlÄÚÖõÄ
format
º¯Êý
ÓÈÆäÊÇÔÚ´¦Àí×Ö·û¸ñʽµÄʱºò,ÀýÈ罫12345ת»»³É12,345ÕâÑùµÄ,Ö»ÒªÓÃ:format(12345,0)¼´¿É,Èç¹ûÓÃformat(12345,2)ÔòÏÔÊ ......
¶ÔÓÚÕë¶Ô×Ö·û´®Î»ÖõIJÙ×÷£¬µÚÒ»¸öλÖñ»±ê¼ÇΪ1¡£
ASCII(str) ·µ»Ø×Ö·û´®strµÄ×î×óÃæ×Ö·ûµÄASCII´úÂëÖµ¡£Èç¹ûstrÊÇ¿Õ×Ö·û´®£¬·µ»Ø0¡£Èç¹ûstrÊÇNULL£¬·µ»ØNULL¡£
mysql> select ASCII('2');
-> 50
mysql> select ASCII(2);
-> 50
mysql> select ASCII('dx');
-> 100
Ò² ......
---- ÔÚÊý¾Ý¿âµÄÓ¦Óÿª·¢ÖУ¬³£³£»áÓöµ½ÐÔÄܺʹú¼ÛµÄÖ®¼äì¶Ü¡£ÒÔ×÷ÕßÔÚ¿ª·¢¹ÉÊÐÐÐ
Çé²éѯºÍ½»Ò×ϵͳÖÐÓöµ½µÄÎÊÌâΪÀý£¬ÒªÔÚʵʱ¼Ç¼1000¶àÖ»¹ÉƱÿ·ÖÖÓ¸üÐÂÒ»´ÎµÄÐÐ
ÇéÊý¾ÝµÄͬʱ£¬ÏìÓ¦´óÁ¿²¢·¢Óû§µÄÊý¾Ý²éѯÇëÇ󡣿¼Âǵ½ÐԼ۱ȺÍÒ×ά»¤ÐÔ£¬ÏµÍ³ÓÖ
ÒªÇóÔÚ»ùÓÚPC·þÎñÆ÷£¬Windows NTƽ̨µÄÈíÓ²¼þ»·¾³ÏÂʵÏÖ¡£¿ª ......
×î½üÔÚ×öPHPÓëÊý¾Ý¿â½»»¥µÄproject£¬¼±ÓÚÇó³É£¬Ä£·ÂÁËÏÂÀý×ӾͿªÊ¼¶¯ÊÖ£¬½á¹ûÎó°Ñmysql_fetch_arrayд³ÉÁËmysql_fetch_row,囧ÊÂÀ´ÁË£¬·¢ÏÖ·µ»ØµÄÊý×é¾ÓÈ»ÊÇindex=>valueµÄÐÎʽ£¬¶øÃ÷Ã÷¼ÇµÃÊÇfield name=>valueµÄ¹þ£¬²éÊÖ²á²ÅÃ÷°×¡£
1. mysql_fetch_arrayµÄº¯ÊýÔÐÍÊÇ
array mysql_fetch_array ( resour ......