TAILIEUCHUNG - Beginning PHP6, Apache, MySQL Web Development- P5

Beginning PHP6, Apache, MySQL Web Development- P5:Welcome to Beginning PHP6, Apache, MySQL Web Development , your new trusty resource for assistance in creating your own dynamic web sites. There are a lot of technologies available that can be used to deliver great web sites, and we ’ re glad you chose the Apache/MySQL/PHP (sometimes referred to simply as AMP) approach. You may or may not have had a taste of these three components in the past, but either way we ’ re confident that you will be impressed with the power that lies within them | Chapter 3 Using PHP with MySQL Querying the Database Now that you have some data in the database you probably want to retrieve it. You use the SELECT statement to choose data that fits your criteria. Typical syntax for this command is as follows SELECT field names AS alias FROM f ablename WHERE criteria ORDER BY fieldname to sort on ASC DESC LIMIT f ffset faxrows You can set numerous other parameters but these are the most commonly used SELECT field names First decide what specific field names you want to retrieve. If you want to see them all you can use in place of the field names. AS You use alias field names so that you can reference them later as different names. An example would be SELECT movie_name movie_year AS relase_year FROM movie FROM You need to name the table or tables from which you are pulling the data. WHERE List your criteria for filtering out the data as described in the following section. ORDER BY Use this parameter if you want the data sorted on a particular field. The results are returned in ascending order by default though you can explicitly request ascending order with ASC. If you want the results returned in descending order use DESC. LIMIT This enables you to limit the number of results returned and offset the first record returned to whatever number you choose. An example would be LIMIT 9 10 This would show records 10 through 19. This is a useful feature for pagination showing only a certain number of records on a page and then allowing the user to click a Next page link to see more . For a complete reference we refer you to the official documentation at . WHERE oh WHERE The beast clause called WHERE deserves its own little section because it s really the meat of the query. No offense to the other clauses but they are pretty much no brainers. WHERE is like a cool big brother who can really do some interesting stuff. While SELECT tells MySQL which fields you want to see WHERE tells it which records you want to see. It is used

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
86    4    0    11-08-2020
12    4    0    11-08-2020
21    8    0    11-08-2020
37    4    0    11-08-2020
4    2    0    11-08-2020
54    4    0    11-08-2020
5    5    0    11-08-2020
3    6    0    11-08-2020
TÀI LIỆU LIÊN QUAN
19    16    0
182    15    0
138    6    0
3    7    0
142    12    0