8-3 ¤À¶ÂsÄý(8-3-1 ¤À¶°ò¦)
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-25
|
8-3 ¤À¶ÂsÄý(8-3-1 ¤À¶°ò¦)
8-3 ¤À¶ÂsÄý
·í§Ú̸ê®Æµ§¼Æ¤Ó¦h¡AYn¤@¦¸±N¥þ³¡¸ê®Æ°e¥æÂsÄý¾¹¤¤¨Ó¾\Ū¡A¤£¶È³y¦¨ÂsÄý¾¹¸ÑĶ®Éªº¨I«t¾á¡A¸ê®Æ¤U¸üªº®É¶¡¤]·|©ìªº«Üªø¡A¦]¦¹¡A·í¸ê®Æ¶q¤j®É¡A±N¸ê®Æ¤À¦¨¦h¦¸´£¨ú¨Ó¾\Ū¬OÓ¬Û·í¤£¿ùªº°µªk¡C
8-3-1 ¤À¶°ò¦
¡umysql_num_rows()¡v¨ç¼Æ¥i¥Î¨ÓÀòª¾¡umysql_quary()¡v¨ç¼Æ¤¤ªº¸ê®Æ°O¿ýÁ`µ§¼Æ¡A¨ä¦^¶ÇȬ°¤@¾ã¼ÆÈ¡A¦ýµ§ªÌ¥²¶·´£¿ô±z¡A§Q¥Î¡umysql_num_rows()¡v¨ç¼Æ¨ÓÀòª¾¡umysql_quary()¡v¨ç¼Æ¤¤ªº¸ê®Æ°O¿ýÁ`µ§¼Æ®É¡A¡umysql_num_rows()¡v¨ç¼Æ¥²¶·Åª¥þ³¡°O¿ý¸ê®Æ¨Ópºâµ§¼Æ¡A©Ò¥H¤ñ¸û®ø¯Ó¨t²Î¸ê·½¡]µ§ªÌ³q±`¥HSQL«ü¥O±Ôz¨Ó¨ú±o¸ê®ÆÁ`µ§¼Æ¡A¦Ó«D¥H¡umysql_num_rows()¡v¨ç¼Æ¨Ó¨ú±oÁ`µ§¼Æ¡^¡C
¨Ò¦p¡G- //¨ú±o¸ê®Æ¿ý¼Æ¶q
- $rowsnum=mysql_num_rows($datalist);
- //¦C¦LÁ`µ§¼Æ
- echo "¸ê®ÆÁ`µ§¼Æ $rowsnum";
½Æ»s¥N½X |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-25
|
±oª¾¸ê®ÆªºÁ`µ§¼Æ«á¡An±N¸ê®Æ¿ý¤À¶Åã¥Ü¤§«e¡A¥²¶·¨M©w¨C¤@¶n¦³¦h¤Ö¼Æ¶qªº¸ê®Æ°O¿ý¡A¦Ó¥þ³¡ªº¸ê®Æ°O¿ý±Nn¤À¦¨¦h¤Ö¶¡A¨Ò¦p¤U¨Ò¤¤¡A§Ú̱N¨C10µ§¸ê®Æ¬°¤@³æ¦ì¤À¶Åã¥Ü¡G- //¨ú±oÄæ¦ì¼Æ¶q
- $fieldnum=mysql_num_fields($datalist);
- //¨ú±o¸ê®Æ¿ý¼Æ¶q
- $rowsnum=mysql_num_rows($datalist);
- //pºâÁ`¦@¦³¦h¤Ö¤À¶
- if (($rowsnum / 10) >intval($rowsnum / 10))
- {
- $TotalPage=intval($rowsnum / 10)+1;
- }
- else
- {
- $TotalPage=intval($rowsnum / 10);
- }
½Æ»s¥N½X ¥ý§Q¥Î¡umysql_num_rows()¡v¨ç¼Æ¨ú±oÁ`¸ê®Æµ§¼Æ¡A±µµÛpºâ¤À¶ªºÁ`¶¼ÆTotalPage¡AY¸ê®Æ¿ý¼Æ¶qµLªk¾ã°£¡A¤]´N¬O¤£º¡¤@¶ªº³Ñ¾l¸ê®Æ¿ý¤]nºâ¤@¶¡A¨Ò¦p¡G§Q¥Î¡umysql_num_rows()¡v¨ç¼Æ§i¶D§Ú̦@Ū¨ú¡ustudentlist¡]³q°T¿ý¡^¡v¸ê®Æªí¤¤466µ§¸ê®Æ¡A§Ú̳]©wÅã¥Ü¨C¶10µ§¸ê®Æ¡A«hÁ`¤À¶¬°¡u47¡v¡A46Óº¡¶¥[¤W¤@Ó¥u¦³6µ§¸ê®Æ¿ýªº¤À¶¡C
¹Ï8-24 ½d¨Òex08_21.php¡C
ex08_21.php(¸`¿ý)- <?
- $conn = mysql_connect("localhost", "root", "12345a");
- if(@mysql_select_db("STUDENTS", $conn))
- {
- //«ü©w´£¨ú¸ê®Æªº®Õ¹ï¦r¤¸ªí
- mysql_query("set character set big5");
- //¸ê®Æ®w¦s¦b,«Ø¥ßSQL©R¥O¦r¦ê
- $SQL="SELECT * FROM studentlist";
- //±N¦^¶Çµ²ªG¦s©ñ©óÅܼƤ¤
- $datalist=mysql_query($SQL);
- //¨ú±oÄæ¦ì¼Æ¶q
- $fieldnum=mysql_num_fields($datalist);
- //¨ú±o¸ê®Æ¿ý¼Æ¶q
- $rowsnum=mysql_num_rows($datalist);
- //pºâÁ`¦@¦³¦h¤Ö¤À¶
- if (($rowsnum / 10) >intval($rowsnum / 10))
- {
- $TotalPage=intval($rowsnum / 10)+1;
- }
- else
- {
- $TotalPage=intval($rowsnum / 10);
- }
- ?>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=big5">
- <title>½d¨Òex08_21</title>
- </head><body>
- <?="¦@$rowsnum µ§¸ê®Æ;¦@$TotalPage ±i¤À¶";?>
- <center><table border=1 width=100%>
- //¡K²¤
½Æ»s¥N½X |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
- ©«¤l
- 46
- ¥DÃD
- 8
- ºëµØ
- 0
- ¿n¤À
- 60
- ÂI¦W
- 0
- §@·~¨t²Î
- windows 7 64bit
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW®ç¶é
- µù¥U®É¶¡
- 2012-3-14
- ³Ì«áµn¿ý
- 2018-11-27
|
¤p»x¤j¤j±z¦n¡A
¤À¶ªº³o¤@¬q§Ú«ä¦Ò¦n¤F¤[¡C
if (($rowsnum / 10) >intval($rowsnum / 10))
{
$TotalPage=intval($rowsnum / 10)+1;
}
else
{
$TotalPage=intval($rowsnum / 10);
}
¨ä¤¤ªº if (($rowsnum / 10) >intval($rowsnum / 10))
³o¤@¬q§Ú¤@ª½¤£¤F¸Ñ¡C
·Q½Ð¤p»x¤j¤j¬°§Ú¸Ñ´b¤@¤U¡C
¦b¦¹¥ýÁÂÁ±z¤F¡C:) |
|
Learn Learn Learn
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-25
|
¤ñ¹ï¬O§_¦³¥¼º¡¶ªº¸ê®Æ¿ý
¨Ò¦p10µ§1¶,§A«ä¦Ò¤@¤U,¨º78µ§ºâ´X¶?
intval
(PHP3 , PHP4)
intval --- ¨ú±oÅܼƪº¾ã¼ÆÈ
»yªk : int intval(mixed var, int [base] );
»¡©ú :
¶Ç¦^°Ñ¼Ævarªº¾ã¼ÆÈ¡A¨Ï¥Î«ü©wªºbase°µ¬°Âà´«ªº°ò©³¡]¹w³]Ȭ°10¡^¡Avar¥i¥H¬O¥ô¦óªº«¬ºA¡A¦ý¦b°}¦C©Îª«¥ó¤W¤£¯à¨Ï¥Î¦¹¨ç¦¡¡C |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|