Muutke küpsiste eelistusi

E-raamat: PHP and MySQL Recipes: A Problem-Solution Approach

Teised raamatud teemal:
  • Formaat - PDF+DRM
  • Hind: 67,91 €*
  • * hind on lõplik, st. muud allahindlused enam ei rakendu
  • Lisa ostukorvi
  • Lisa soovinimekirja
  • See e-raamat on mõeldud ainult isiklikuks kasutamiseks. E-raamatuid ei saa tagastada.
Teised raamatud teemal:

DRM piirangud

  • Kopeerimine (copy/paste):

    ei ole lubatud

  • Printimine:

    ei ole lubatud

  • Kasutamine:

    Digitaalõiguste kaitse (DRM)
    Kirjastus on väljastanud selle e-raamatu krüpteeritud kujul, mis tähendab, et selle lugemiseks peate installeerima spetsiaalse tarkvara. Samuti peate looma endale  Adobe ID Rohkem infot siin. E-raamatut saab lugeda 1 kasutaja ning alla laadida kuni 6'de seadmesse (kõik autoriseeritud sama Adobe ID-ga).

    Vajalik tarkvara
    Mobiilsetes seadmetes (telefon või tahvelarvuti) lugemiseks peate installeerima selle tasuta rakenduse: PocketBook Reader (iOS / Android)

    PC või Mac seadmes lugemiseks peate installima Adobe Digital Editionsi (Seeon tasuta rakendus spetsiaalselt e-raamatute lugemiseks. Seda ei tohi segamini ajada Adober Reader'iga, mis tõenäoliselt on juba teie arvutisse installeeritud )

    Seda e-raamatut ei saa lugeda Amazon Kindle's. 

This book is a source of instant solutions, including countless pieces of useful code that you can copy and paste into your own applications, giving you answers fast and saving you hours of coding time. You can also use this book as a reference to the most important aspects of the latest PHP scripting language, including the vital functions you know and love from previous versions of PHP, as well as the functions introduced in PHP 7.

PHP and MySQL Recipes: A Problem-Solution Approach supplies you with complete code for all of the common coding problems you are likely to face when using PHP and MySQL together in your day-to-day web application development. This invaluable guide includes over 200 recipes and covers numerous topics. What you hold in your hands is the answer to all your PHP 7 needs.

Furthermore, this book explains the PHP functionality in detail, including the vastly improved object-oriented capabilities and the new MySQL database extension. PHP and MySQL Recipes will be a useful and welcome companion throughout your career as a web developer, keeping you on the cutting edge of PHP development, ahead of the competition, and giving you all the answers you need, when you need them.

What You'll Learn

  • How to work with arrays, dates and times, strings, files and directories, and dynamic imaging
  • How to write regular expressions in PHP
  • How to use the variables and functions found in PHP
  • How to do web development using PHP, including the creation of forms
  • How to use MySQL databases using phpMyAdmin and other tools and clients
  • How to use MySQL stored routines, PDOs, triggers, views, database queries, transactions, indexes and searching
Who This Book Is For

This reference is for experienced PHP and MySQL programmers and web developers who have at least some PHP and MySQL programming experience.
About the Author xxix
About the Technical Reviewer xxxi
Introduction xxxiii
Chapter 1 Installation and Configuration 1(28)
Recipe 1-1. Installing PHP
1(16)
Problem
1(1)
Solution
1(1)
How it Works
2(15)
Recipe 1-2. Configuring PHP
17(4)
Problem
17(1)
Solution
17(1)
How it Works
18(3)
Recipe 1-3. Compiling PHP
21(5)
Problem
21(1)
Solution
21(1)
How it Works
22(4)
Recipe 1-4. Installing MySQL
26(1)
Problem
26(1)
Solution
26(1)
How it Works
27(1)
Recipe 1-5. Virtual Machines
27(2)
Problem
27(1)
Solution
27(1)
How it Works
28(1)
Chapter 2 Classes and Objects 29(32)
Recipe 2-1. Writing a Simple Class
29(1)
Problem
29(1)
Solution
29(1)
How it Works
29(1)
Recipe 2-2. Writing a Base Class
30(1)
Problem
30(1)
Solution
30(1)
How it Works
30(1)
Recipe 2-3. Writing an Abstract Class
31(2)
Problem
31(1)
Solution
31(1)
How it Works
31(2)
Recipe 2-4. Writing an Interface
33(2)
Problem
33(1)
Solution
33(1)
How it Works
33(2)
Recipe 2-5. Class Members as Regular Functions
35(1)
Problem
35(1)
Solution
35(1)
How it Works
35(1)
Recipe 2-6. Protecting Data and Methods
36(1)
Problem
36(1)
Solution
36(1)
How it Works
36(1)
Recipe 2-7. Mixed Static and Object Context
37(1)
Problem
37(1)
Solution
37(1)
How it Works
38(1)
Recipe 2-8. Referencing Class Members
38(1)
Problem
38(1)
Solution
38(1)
How it Works
38(1)
Recipe 2-9. Instantiation of Classes
39(2)
Problem
39(1)
Solution
39(1)
How it Works
40(1)
Recipe 2-10. Printing Objects
41(1)
Problem
41(1)
Solution
41(1)
How it Works
41(1)
Recipe 2-11. Variable Overloading
42(2)
Problem
42(1)
Solution
42(1)
How it Works
42(2)
Recipe 2-12. Serializing Types and Object
44(2)
Problem
44(1)
Solution
44(1)
How it Works
45(1)
Recipe 2-13. Copying an Object
46(1)
Problem
46(1)
Solution
46(1)
How it Works
46(1)
Recipe 2-14. Using Objects as Functions
47(1)
Problem
47(1)
Solution
47(1)
How it Works
47(1)
Recipe 2-15. Overloading Methods
48(1)
Problem
48(1)
Solution
48(1)
How it Works
48(1)
Recipe 2-16. Debugging Objects
49(2)
Problem
49(1)
Solution
49(1)
How it Works
50(1)
Recipe 2-17. Using Objects without a Class
51(1)
Problem
51(1)
Solution
51(1)
How it Works
51(1)
Recipe 2-18. Directory Iteration
52(1)
Problem
52(1)
Solution
52(1)
How it Works
52(1)
Recipe 2-19. Writing Reusable Code
53(4)
Problem
53(1)
Solution
53(1)
How it Works
53(4)
Recipe 2-20. Avoiding Name Collisions
57(2)
Problem
57(1)
Solution
57(1)
How it Works
57(2)
Recipe 2-21. Autoloading Classes on First Use
59(2)
Problem
59(1)
Solution
59(1)
How it Works
59(2)
Chapter 3 Performing Math Operations 61(16)
Recipe 3-1. Changing the Base Values for Numbers
62(1)
Problem
62(1)
Solution
62(1)
How it Works
62(1)
Recipe 3-2. Converting to a Different Base Value
63(1)
Problem
63(1)
Solution
63(1)
How it Works
63(1)
Recipe 3-3. Storing Binary Values in Integers
64(1)
Problem
64(1)
Solution
64(1)
How it Works
64(1)
Recipe 3-4. Setting and Clearing Bits in Binary
65(1)
Problem
65(1)
Solution
65(1)
How it Works
65(1)
Recipe 3-5. Using Hexadecimal Numbers
66(1)
Problem
66(1)
Solution
66(1)
How it Works
66(1)
Recipe 3-6. Increasing Performance with Binary Shift
67(2)
Problem
67(1)
Solution
67(1)
How it Works
67(2)
Recipe 3-7. Rounding Floating Point Numbers
69(1)
Problem
69(1)
Solution
69(1)
How it Works
69(1)
Recipe 3-8. Generating Random Numbers
70(1)
Problem
70(1)
Solution
70(1)
How it Works
70(1)
Recipe 3-9. Expressing Ratios with Logarithmic Functions
71(1)
Problem
71(1)
Solution
71(1)
How it Works
71(1)
Recipe 3-10. Calculating Future Values
71(2)
Problem
71(1)
Solution
71(1)
How it Works
72(1)
Recipe 3-11. Using Trigonometry to Calculate Distance and Direction
73(1)
Problem
73(1)
Solution
73(1)
How it Works
73(1)
Recipe 3-12. Working with Complex Numbers
74(3)
Problem
74(1)
Solution
74(1)
How it Works
75(2)
Chapter 4 Working with Arrays 77(32)
Recipe 4-1. Creating Arrays
77(2)
Problem
77(1)
Solution
77(1)
How it Works
78(1)
Recipe 4-2. Changing Arrays
79(2)
Problem
79(1)
Solution
79(1)
How it Works
80(1)
Recipe 4-3. Adding Arrays
81(5)
Problem
81(1)
Solution
82(1)
How it Works
82(4)
Recipe 4-4. Arrays of Arrays
86(2)
Problem
86(1)
Solution
86(1)
How it Works
86(2)
Recipe 4-5. Traversing Arrays
88(2)
Problem
88(1)
Solution
88(1)
How it Works
88(2)
Recipe 4-6. Sorting Arrays
90(10)
Problem
90(1)
Solution
90(1)
How It Works
90(10)
Recipe 4-7. Using Arrays as Stacks
100(2)
Problem
100(1)
Solution
101(1)
How it Works
101(1)
Recipe 4-8. Slicing and Splicing Arrays
102(3)
Problem
102(1)
Solution
102(1)
How it Works
102(3)
Recipe 4-9. Debugging Arrays
105(2)
Problem
105(1)
Solution
105(1)
How it Works
106(1)
Recipe 4-10. Storing Arrays
107(2)
Problem
107(1)
Solution
107(1)
How it Works
107(2)
Chapter 5 Dates and limes 109(16)
Recipe 5-1. Working with Time Zones
109(1)
Problem
109(1)
Solution
109(1)
How it Works
110(1)
Recipe 5-2. Creating a Timestamp
110(2)
Problem
110(1)
Solution
110(1)
How it Works
111(1)
Recipe 5-3. Working with Dates
112(1)
Problem
112(1)
Solution
112(1)
How it Works
112(1)
Recipe 5-4. Displaying Timestamps
113(3)
Problem
113(1)
Solution
113(1)
How it Works
113(3)
Recipe 5-5. Using ISO Formats
116(1)
Problem
116(1)
Solution
116(1)
How it Works
116(1)
Recipe 5-6. Working with Week Numbers
117(1)
Problem
117(1)
Solution
117(1)
How it Works
118(1)
Recipe 5-7. The DateTime Class
118(4)
Problem
118(1)
Solution
118(1)
How it Works
118(4)
Recipe 5-8. Storing Date and Time Values
122(1)
Problem
122(1)
Solution
122(1)
How it Works
122(1)
Recipe 5-9. Calculating Elapsed Time
123(2)
Problem
123(1)
Solution
123(1)
How it Works
123(2)
Chapter 6 Strings 125(18)
Recipe 6-1. Creating Strings
125(1)
Problem
125(1)
Solution
125(1)
How it Works
125(1)
Recipe 6-2. Working with the Characters in a String
126(1)
Problem
126(1)
Solution
126(1)
How it Works
126(1)
Recipe 6-3. Replacing Characters
127(1)
Problem
127(1)
Solution
127(1)
How it Works
127(1)
Recipe 6-4. Creating Long Strings with Heredoc and Newdoc
128(2)
Problem
128(1)
Solution
128(1)
How it Works
128(2)
Recipe 6-5. Escaping Strings
130(2)
Problem
130(1)
Solution
131(1)
How it Works
131(1)
Recipe 6-6. Reformatting Strings
132(1)
Problem
132(1)
Solution
132(1)
How it Works
132(1)
Recipe 6-7. Trimming Whitespace
133(1)
Problem
133(1)
Solution
133(1)
How it Works
133(1)
Recipe 6-8. Finding Strings in Strings
133(2)
Problem
133(1)
Solution
134(1)
How it Works
134(1)
Recipe 6-9. Dividing Strings into Substrings
135(2)
Problem
135(1)
Solution
135(1)
How it Works
135(2)
Recipe 6-10. Displaying HTML Entities
137(2)
Problem
137(1)
Solution
137(1)
How it Works
137(2)
Recipe 6-11. Generating Hash Values for Files
139(2)
Problem
139(1)
Solution
139(1)
How it Works
139(2)
Recipe 6-12. Storing Passwords
141(2)
Problem
141(1)
Solution
141(1)
How it Works
141(2)
Chapter 7 Files and Directories 143(26)
Recipe 7-1. Include and Require
143(2)
Problem
143(1)
Solution
143(1)
How it Works
144(1)
Recipe 7-2. Reading Files
145(2)
Problem
145(1)
Solution
145(1)
How it Works
146(1)
Recipe 7-3. Writing Files
147(1)
Problem
147(1)
Solution
147(1)
How it Works
148(1)
Recipe 7-4. Copy, Rename, and Remove Files
148(2)
Problem
148(1)
Solution
149(1)
How it Works
149(1)
Recipe 7-5. File Properties
150(2)
Problem
150(1)
Solution
150(1)
How it Works
150(2)
Recipe 7-6. Permissions
152(1)
Problem
152(1)
Solution
152(1)
How it Works
152(1)
Recipe 7-7. Symbolic Links
153(2)
Problem
153(1)
Solution
153(1)
How it Works
153(2)
Recipe 7-8. Directories
155(1)
Problem
155(1)
Solution
155(1)
How it Works
155(1)
Recipe 7-9. CSV Files
156(3)
Problem
156(1)
Solution
156(1)
How it Works
156(3)
Recipe 7-10. Streams
159(1)
Problem
159(1)
Solution
159(1)
How it Works
159(1)
Recipe 7-11. Stream Context
160(2)
Problem
160(1)
Solution
160(1)
How it Works
160(2)
Recipe 7-12. File Iterators
162(2)
Problem
162(1)
Solution
162(1)
How it Works
162(2)
Recipe 7-13. Download Files
164(1)
Problem
164(1)
Solution
164(1)
How it Works
164(1)
Recipe 7-14. Upload Files
165(1)
Problem
165(1)
Solution
165(1)
How it Works
165(1)
Recipe 7-15. Zipped Files
166(3)
Problem
166(1)
Solution
166(1)
How it Works
167(2)
Chapter 8 Dynamic Imaging 169(28)
Recipe 8-1. Creating Images
169(2)
Problem
169(1)
Solution
169(1)
How it Works
170(1)
Recipe 8-2. Image Resize
171(2)
Problem
171(1)
Solution
171(1)
How it Works
171(2)
Recipe 8-3. Image Crop
173(3)
Problem
173(1)
Solution
173(1)
How it Works
173(3)
Recipe 8-4. Image Rotate
176(1)
Problem
176(1)
Solution
176(1)
How it Works
176(1)
Recipe 8-5. Image Flip
177(1)
Problem
177(1)
Solution
177(1)
How it Works
177(1)
Recipe 8-6. Adding a Watermark
178(2)
Problem
178(1)
Solution
178(1)
How it Works
179(1)
Recipe 8-7. Changing Colors
180(2)
Problem
180(1)
Solution
180(1)
How it Works
180(2)
Recipe 8-8. Draw on Images
182(8)
Problem
182(1)
Solution
182(1)
How it Works
182(8)
Recipe 8-9. Transparency
190(1)
Problem
190(1)
Solution
190(1)
How it Works
190(1)
Recipe 8-10. Adding Text
191(2)
Problem
191(1)
Solution
191(1)
How it Works
191(2)
Recipe 8-11. Caching Images
193(4)
Problem
193(1)
Solution
193(1)
How it Works
193(4)
Chapter 9 Regular Expressions 197(12)
Recipe 9-1. Format Validation
200(3)
Problem
200(1)
Solution
200(1)
How it Works
200(3)
Recipe 9-2. Sub Patterns
203(2)
Problem
203(1)
Solution
203(1)
How it Works
203(2)
Recipe 9-3. String Replacement
205(4)
Problem
205(1)
Solution
205(1)
How It Works
206(3)
Chapter 10 Variables 209(22)
Recipe 10-1. Converting Variable Type
209(1)
Problem
209(1)
Solution
209(1)
How it Works
210(1)
Recipe 10-2. Allocating Memory
210(2)
Problem
210(1)
Solution
210(1)
How it Works
211(1)
Recipe 10-3. Determining Memory Use
212(1)
Problem
212(1)
Solution
212(1)
How it Works
212(1)
Recipe 10-4. Taking Advantage of Variable Scope
213(1)
Problem
213(1)
Solution
213(1)
How it Works
213(1)
Recipe 10-5. Avoiding Global Variable Problems with Super Globals
214(1)
Problem
214(1)
Solution
214(1)
How it Works
214(1)
Recipe 10-6. Determining Variable Type
215(1)
Problem
215(1)
Solution
215(1)
How it Works
215(1)
Recipe 10-7. Reducing Memory Use with References
216(3)
Problem
216(1)
Solution
216(1)
How it Works
216(3)
Recipe 10-8. Using Constants
219(1)
Problem
219(1)
Solution
219(1)
How it Works
219(1)
Recipe 10-9. Variable Variables
220(1)
Problem
220(1)
Solution
220(1)
How it Works
220(1)
Recipe 10-10. Comparing Variables
221(2)
Problem
221(1)
Solution
221(1)
How it Works
222(1)
Recipe 10-11. Working with Strings
223(1)
Problem
223(1)
Solution
223(1)
How it Works
223(1)
Recipe 10-12. Handling Floating Point Numbers
224(1)
Problem
224(1)
Solution
224(1)
How it Works
224(1)
Recipe 10-13. Special Language Constructs
225(3)
Problem
225(1)
Solution
225(1)
How it Works
225(3)
Recipe 10-14. Iterating Over Array Values
228(1)
Problem
228(1)
Solution
228(1)
How it Works
229(1)
Recipe 10-15. Generating Output
229(2)
Problem
229(1)
Solution
229(1)
How it Works
230(1)
Chapter 11 Functions 231(18)
Recipe 11-1. Calling Functions
231(1)
Problem
231(1)
Solution
231(1)
How it Works
232(1)
Recipe 11-2. Variable Scope
232(2)
Problem
232(1)
Solution
232(1)
How it Works
233(1)
Recipe 11-3. Passing Parameters
234(2)
Problem
234(1)
Solution
234(1)
How it Works
234(2)
Recipe 11-4. Optional Parameters
236(2)
Problem
236(1)
Solution
236(1)
How it Works
236(2)
Recipe 11-5. Type Declarations
238(1)
Problem
238(1)
Solution
238(1)
How it Works
238(1)
Recipe 11-6. Return Values
239(2)
Problem
239(1)
Solution
239(1)
How it Works
239(2)
Recipe 11-7. Check if Function Exists
241(1)
Problem
241(1)
Solution
241(1)
How it Works
241(1)
Recipe 11-8. Calculated Function Names
242(1)
Problem
242(1)
Solution
242(1)
How it Works
242(1)
Recipe 11-9. Anonymous Functions
243(3)
Problem
243(1)
Solution
243(1)
How it Works
243(3)
Recipe 11-10. Variable Parameter List
246(3)
Problem
246(1)
Solution
246(1)
How it Works
246(3)
Chapter 12 Web Fundamentals 249(22)
Recipe 12-1. Headers
249(1)
Problem
249(1)
Solution
249(1)
How it Works
250(1)
Recipe 12-2. $_GET and $_POST
250(3)
Problem
250(1)
Solution
251(1)
How it Works
251(2)
Recipe 12-3. Cookies
253(2)
Problem
253(1)
Solution
253(1)
How it Works
254(1)
Recipe 12-4. Server Variables
255(2)
Problem
255(1)
Solution
255(1)
How it Works
255(2)
Recipe 12-5. Session Data
257(2)
Problem
257(1)
Solution
257(1)
How it Works
258(1)
Recipe 12-6. Content Type and Disposition
259(2)
Problem
259(1)
Solution
259(1)
How it Works
259(2)
Recipe 12-7. Caching
261(1)
Problem
261(1)
Solution
261(1)
How it Works
261(1)
Recipe 12-8. Remote Content
262(3)
Problem
262(1)
Solution
262(1)
How it Works
263(2)
Recipe 12-9. The HTTPS Protocol
265(1)
Problem
265(1)
Solution
265(1)
How it Works
265(1)
Recipe 12-10. AJAX Requests
266(1)
Problem
266(1)
Solution
266(1)
How it Works
266(1)
Recipe 12-11. Web Sockets
267(4)
Problem
267(1)
Solution
267(1)
How it Works
267(4)
Chapter 13 Creating and Using Forms 271(22)
Recipe 13-1. Form Elements
271(5)
Problem
271(1)
Solution
271(3)
How it Works
274(2)
Recipe 13-2. Default Values
276(4)
Problem
276(1)
Solution
276(1)
How it Works
277(3)
Recipe 13-3. Form Validation
280(3)
Problem
280(1)
Solution
280(1)
How it Works
280(3)
Recipe 13-4. Form Generation
283(5)
Problem
283(1)
Solution
283(1)
How it Works
284(4)
Recipe 13-5. File Upload
288(2)
Problem
288(1)
Solution
288(1)
How it Works
289(1)
Recipe 13-6. Form Data
290(3)
Problem
290(1)
Solution
290(1)
How it Works
291(2)
Chapter 14 XML, RSS, WDDX, and SOAP 293(24)
Recipe 14-1. Exchanging Data with XML
293(7)
Problem
293(1)
Solution
293(1)
How it Works
294(6)
Recipe 14-2. Generating XML Response
300(3)
Problem
300(1)
Solution
300(1)
How it Works
300(3)
Recipe 14-3. Sharing Data with RSS
303(3)
Problem
303(1)
Solution
304(1)
How it Works
304(2)
Recipe 14-4. Consuming RSS Feeds
306(2)
Problem
306(1)
Solution
307(1)
How it Works
307(1)
Recipe 14-5. Standard Data Exchange
308(3)
Problem
308(1)
Solution
308(1)
How it Works
309(2)
Recipe 14-6. SOAP Server and Client
311(6)
Problem
311(1)
Solution
311(1)
How it Works
311(6)
Chapter 15 Data Exchange with JSON 317(16)
Recipe 15-1. Fetching Data with AJAX
317(2)
Problem
317(1)
Solution
317(1)
How it Works
317(2)
Recipe 15-2. Returning JSON
319(2)
Problem
319(1)
Solution
319(1)
How it Works
320(1)
Recipe 15-3. Consuming a JSON API
321(3)
Problem
321(1)
Solution
321(1)
How it Works
321(3)
Recipe 15-4. JSON API
324(3)
Problem
324(1)
Solution
324(1)
How it Works
325(2)
Recipe 15-5. Calling API's
327(3)
Problem
327(1)
Solution
327(1)
How it Works
327(3)
Recipe 15-6. API Authentication
330(3)
Problem
330(1)
Solution
330(1)
How it Works
330(3)
Chapter 16 Using MySQL Databases 333(24)
Recipe 16-1. Connecting to MySQL
333(4)
Problem
333(1)
Solution
333(1)
How it Works
334(3)
Recipe 16-2. Persistent Connections
337(1)
Problem
337(1)
Solution
337(1)
How it Works
338(1)
Recipe 16-3. Fetching Data
338(3)
Problem
338(1)
Solution
339(1)
How it Works
339(2)
Recipe 16-4. Inserting Data
341(7)
Problem
341(1)
Solution
341(1)
How it Works
341(7)
Recipe 16-5. Updating Data
348(3)
Problem
348(1)
Solution
348(1)
How it Works
349(2)
Recipe 16-6. Deleting Data
351(4)
Problem
351(1)
Solution
351(1)
How it Works
351(4)
Recipe 16-7. Schema Information
355(2)
Problem
355(1)
Solution
355(1)
How it Works
356(1)
Index 357
Frank M. Kromann has spent more than 30 years solving business problems using software and technology. Since the introduction of the first web browser he has developed systems with web technology on Unix, Linux, Windows and Mac platforms, with the primary focus on PHP, JavaScript, C/C++, and other languages. He has contributed several PHP extensions over the years and has been a member of the PHP development team since 1997. Previous publications included several articles in PHP Magazine and he was the co-author on PHP 5 Recipes. Frank M. Kromann has held managing positions for more than 20 years, leading both smaller and larger teams in development and implementation of business systems and processes utilizing databases and programming. He is currently an Engineering Manager at Panasonic Avionics and the CEO and co-founder of Web by Pixel, Inc. He holds a Master of Science degree in electrical engineering from the Technical University of Denmark.