- ©«¤l
- 4
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 25
- ÂI¦W
- 0
- §@·~¨t²Î
- win8
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2014-10-3
- ³Ì«áµn¿ý
- 2014-11-27
|
¬ÛïÅã¥Ü SQL°ÝÃD
- <?php
- header("Content-Type: text/html; charset=utf-8");
- include_once("sql_connect.php");
- include_once("my_msg.php");
- //¹w³]¨C¶µ§¼Æ
- $pageRow_records = 8;
- //¹w³]¶¼Æ
- $num_pages = 1;
- //Y¤w¸g¦³Â½¶¡A±N¶¼Æ§ó·s
- if (isset($_GET['page'])) {
- $num_pages = $_GET['page'];
- }
- $album_owner = $_COOKIE['cookie_id'];
- echo $album_owner;
- //¥»¶¶}©l°O¿ýµ§¼Æ = (¶¼Æ-1)*¨C¶°O¿ýµ§¼Æ
- $startRow_records = ($num_pages -1) * $pageRow_records;
- //¥¼¥[¨îÅã¥Üµ§¼ÆªºSQL±Ôz¥y
- /*$query_RecAlbum = "SELECT `album`.`album_id` , `album`.`album_date` , `album`.`album_location` ,
- `album`.`album_title` , `album`.`album_desc` , `albumphoto`.`ap_picurl`,
- count( `albumphoto`.`ap_id` ) AS `albumNum` FROM `album` LEFT JOIN `albumphoto`
- ON `album`.`album_id` = `albumphoto`.`album_id` WHERE `album`.`album_owner` = `$album_owner` GROUP BY `album`.`album_id` ,
- `album`.`album_date` , `album`.`album_location` , `album`.`album_title` , `album`.`album_desc`
- ORDER BY `album_date` DESC " ;*/
- $query_RecAlbum = "SELECT `album`.`album_id` , `album`.`album_date` , `album`.`album_location` ,
- `album`.`album_title` , `album`.`album_desc` , `albumphoto`.`ap_picurl`,
- count( `albumphoto`.`ap_id` ) AS `albumNum` FROM `album` LEFT JOIN `albumphoto`
- ON `album`.`album_id` = `albumphoto`.`album_id` where `album`.`album_owner` = $album_owner GROUP BY `album`.`album_id` ,
- `album`.`album_date` , `album`.`album_location` , `album`.`album_title` , `album`.`album_desc`
- ORDER BY `album_date` DESC " ;
- //¥[¤W¨îÅã¥Üµ§¼ÆªºSQL±Ôz¥y¡A¥Ñ¥»¶¶}©l°O¿ýµ§¼Æ¶}©l¡A¨C¶Åã¥Ü¹w³]µ§¼Æ
- $query_limit_RecAlbum = $query_RecAlbum." LIMIT ".$startRow_records.", ".$pageRow_records;
- //¥H¥[¤W¨îÅã¥Üµ§¼ÆªºSQL±Ôz¥y¬d¸ß¸ê®Æ¨ì $RecAlbum ¤¤
- $RecAlbum = mysql_query($query_limit_RecAlbum);
- //¥H¥¼¥[¤W¨îÅã¥Üµ§¼ÆªºSQL±Ôz¥y¬d¸ß¸ê®Æ¨ì $all_RecAlbum ¤¤
- $all_RecAlbum = mysql_query($query_RecAlbum) ;
- //pºâÁ`µ§¼Æ
- $total_records = mysql_num_rows($all_RecAlbum) or die(mysql_error());
- //pºâÁ`¶¼Æ=(Á`µ§¼Æ/¨C¶µ§¼Æ)«áµL±ø¥ó¶i¦ì¡C
- $total_pages = ceil($total_records/$pageRow_records);
- ?>
½Æ»s¥N½X ¿ù»~Åã¥Ü
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\sample\demo1\index.php on line 37
Unknown column 'aaa' in 'where clause'
¸Ó¦æªºµ{¦¡½X
$total_records = mysql_num_rows($all_RecAlbum) or die(mysql_error());
Á`¦@3Ó±b¸¹
¥u¦³¤@Ó¥i¥H¥¿±`Åã¥Ü
¨ä¥L¨âÓ±b¸¹³£·|Åã¥Ü¤W±ªº¿ù»~
¦A²q¬O¤£¬Oquery¨ºÃ䪺°ÝÃD¶Ü?
¦³½Ð¦U¦ì¤j¤jÀ°¦£¤F |
|