Learning PHP MySQL JavaScript With jQuery CSS HTML5 Early Release 5th 5th Edition Robin Nixon instant download
Learning PHP MySQL JavaScript With jQuery CSS HTML5 Early Release 5th 5th Edition Robin Nixon instant download
https://ebookfinal.com/download/learning-php-mysql-javascript-
with-jquery-css-html5-early-release-5th-5th-edition-robin-nixon/
https://ebookfinal.com/download/learning-php-mysql-javascript-and-
css-2nd-edition-robin-nixon/
https://ebookfinal.com/download/css-floating-floats-and-float-shapes-
early-release-1-early-release-edition-eric-a-meyer/
https://ebookfinal.com/download/thoughtful-machine-learning-with-
python-early-release-matthew-kirk/
https://ebookfinal.com/download/html5-programming-with-javascript-for-
dummies-mueller/
Learning jQuery 4th Edition Better interaction design and
web development with simple JavaScript techniques Jonathan
Chaffer
https://ebookfinal.com/download/learning-jquery-4th-edition-better-
interaction-design-and-web-development-with-simple-javascript-
techniques-jonathan-chaffer/
https://ebookfinal.com/download/php-mysql-novice-to-ninja-5th-edition-
the-easy-way-to-build-your-own-database-driven-website-kevin-yank/
https://ebookfinal.com/download/starting-out-with-c-early-objects-5th-
edition-tony-gaddis/
https://ebookfinal.com/download/core-web-application-development-with-
php-and-mysql-1-printing-edition-wandschneider/
Learning PHP MySQL JavaScript With jQuery CSS
HTML5 Early Release 5th 5th Edition Robin Nixon
Digital Instant Download
Author(s): Robin Nixon
ISBN(s): 9781491978917, 1491978910
Edition: 5
File Details: PDF, 7.50 MB
Year: 2018
Language: english
Learning PHP, MySQL, & JavaScript
With jQuery, CSS, & HTML5
Fifth Edition
Robin Nixon
In fact, anyone ready to learn the fundamentals behind the Web 2.0 technology known as Ajax
will obtain a thorough grounding in all of these core technologies: PHP, MySQL, JavaScript,
CSS, and HTML5, and learn the basics of the jQuery and jQuery Mobile libraries too.
Assumptions This Book Makes
This book assumes that you have a basic understanding of HTML and can at least put together a
simple, static website, but does not assume that you have any prior knowledge of PHP, MySQL,
JavaScript, CSS, or HTML5—although if you do, your progress through the book will be even
quicker.
Organization of This Book
The chapters in this book are written in a specific order, first introducing all of the core
technologies it covers and then walking you through their installation on a web development
server so that you will be ready to work through the examples.
In the first section, you will gain a grounding in the PHP programming language, covering the
basics of syntax, arrays, functions, and object-oriented programming.
Then, with PHP under your belt, you will move on to an introduction to the MySQL database
system, where you will learn everything from how MySQL databases are structured to how to
generate complex queries.
After that, you will learn how you can combine PHP and MySQL to start creating your own
dynamic web pages by integrating forms and other HTML features. Following that, you will get
down to the nitty-gritty practical aspects of PHP and MySQL development by learning a variety
of useful functions and how to manage cookies and sessions, as well as how to maintain a high
level of security.
In the next few chapters, you will gain a thorough grounding in JavaScript, from simple
functions and event handling to accessing the Document Object Model and in-browser validation
and error handling, plus a comprehensive primer on using the popular jQuery library for
JavaScript.
With an understanding of all three of these core technologies, you will then learn how to make
behind-the-scenes Ajax calls and turn your websites into highly dynamic environments.
Next, you’ll spend two chapters learning all about using CSS to style and lay out your web
pages, before discovering how the jQuery libraries can make your development job a great deal
easdier, and then moving on to the final section on the interactive features built into HTML5,
including geolocation, audio, video, and the canvas. After this, you’ll put together everything
you’ve learned in a complete set of programs that together constitute a fully functional social
networking website.
Along the way, you’ll find plenty of advice on good programming practices and tips that could
help you find and solve hard-to-detect programming errors. There are also plenty of links to
websites containing further details on the topics covered.
Supporting Books
Once you have learned to develop using PHP, MySQL, JavaScript, CSS, and HTML5, you will
be ready to take your skills to the next level using the following O’Reilly reference books. To
learn more about any of these titles, simply enter the ISBN shown next to it into the search box at
http://oreilly.com or at any good online book seller’s website.
Plain text
Indicates menu titles, options, and buttons.
Italic
Indicates new terms, URLs, email addresses, filenames, file extensions, pathnames,
directories, and Unix utilities.
Constant width
Indicates command-line options, variables and other code elements, HTML tags, macros,
and the contents of files.
Constant width bold
Shows program output or highlighted sections of code that are discussed in the text.
Constant width italic
Shows text that should be replaced with user-supplied values.
Note
Warning
We appreciate, but do not require, attribution. An attribution usually includes the title, author,
publisher, and ISBN. For example: “Learning PHP, MySQL & JavaScript, 5th Edition by Robin
Nixon (O’Reilly). Copyright 2018 Robin Nixon,
.”
If you feel your use of code examples falls outside fair use or the permission given above, feel
free to contact us at permissions@oreilly.com.
How to Contact Us
Please address comments and questions concerning this book to the publisher:
Sebastopol, CA 95472
We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at http://bit.ly/lpmjch_4e.
For more information about our books, courses, conferences, and news, see our website at
http://www.oreilly.com.
??? ??? for his comprehensive technical review, ??? ??? for overseeing production, ??? ??? for
copy editing, ??? ??? for proofreading, Robert Romano and Rebecca Demarest for their
illustrations, ??? ??? for interior design, ??? ??? for creating the index, Karen Montgomery for
the original sugar glider front cover design, ??? ??? for the latest book cover, and everyone else
too numerous to name who submitted errata and offered suggestions for this new edition.
Chapter 1. Introduction to Dynamic Web
Content
The World Wide Web is a constantly evolving network that has already traveled far beyond its
conception in the early 1990s, when it was created to solve a specific problem. State-of-the-art
experiments at CERN (the European Laboratory for Particle Physics—now best known as the
operator of the Large Hadron Collider) were producing incredible amounts of data—so much
that the data was proving unwieldy to distribute to the participating scientists who were spread
out across the world.
At this time, the Internet was already in place, connecting several hundred thousand computers,
so Tim Berners-Lee (a CERN fellow) devised a method of navigating between them using a
hyperlinking framework, which came to be known as Hypertext Transfer Protocol, or HTTP. He
also created a markup language called Hypertext Markup Language, or HTML. To bring these
together, he wrote the first web browser and web server, tools that we now take for granted.
But back then, the concept was revolutionary. The most connectivity so far experienced by at-
home modem users was dialing up and connecting to a bulletin board that was hosted by a single
computer, where you could communicate and swap data only with other users of that service.
Consequently, you needed to be a member of many bulletin board systems in order to effectively
communicate electronically with your colleagues and friends.
But Berners-Lee changed all that in one fell swoop, and by the mid-1990s, there were three
major graphical web browsers competing for the attention of 5 million users. It soon became
obvious, though, that something was missing. Yes, pages of text and graphics with hyperlinks to
take you to other pages was a brilliant concept, but the results didn’t reflect the instantaneous
potential of computers and the Internet to meet the particular needs of each user with
dynamically changing content. Using the Web was a very dry and plain experience, even if we
did now have scrolling text and animated GIFs!
Shopping carts, search engines, and social networks have clearly altered how we use the Web. In
this chapter, we’ll take a brief look at the various components that make up the Web, and the
software that helps make it a rich and dynamic experience.
Note
It is necessary to start using some acronyms more or less right away. I have tried to clearly
explain them before proceeding. But don’t worry too much about what they stand for or what
these names mean, because the details will become clear as you read on.
(1)
HTTP and HTML: Berners-Lee’s Basics
HTTP is a communication standard governing the requests and responses that take place between
the browser running on the end user’s computer and the web server. The server’s job is to accept
a request from the client and attempt to reply to it in a meaningful way, usually by serving up a
requested web page—that’s why the term server is used. The natural counterpart to a server is a
client, so that term is applied both to the web browser and the computer on which it’s running.
Between the client and the server there can be several other devices, such as routers, proxies,
gateways, and so on. They serve different roles in ensuring that the requests and responses are
correctly transferred between the client and server. Typically, they use the Internet to send this
information. Some of these in-between devices can also help speed up the Internet by storing
pages or information locally in what is called a cache, and then serving these up to clients
directly from this cache, rather than fetching them all the way from the source server.
A web server can usually handle multiple simultaneous connections and—when not
communicating with a client—spends its time listening for an incoming connection. When one
arrives, the server sends back a response to confirm its receipt.
(2)
The Request/Response Procedure
At its most basic level, the request/response process consists of a web browser asking the web
server to send it a web page and the server sending back the page. The browser then takes care of
displaying the page (see Figure 1-1).
(3)
Figure 1-1. The basic client/server request/response sequence
4. The request crosses the Internet and arrives at the server.com web server.
5. The web server, having received the request, looks for the web page on its disk.
6. The web page is retrieved by the server and returned to the browser.
For an average web page, this process takes place once for each object within the page: a
graphic, an embedded video or Flash file, and even a CSS template.
(4)
In step 2, notice that the browser looked up the IP address of server.com. Every machine attached
to the Internet has an IP address—your computer included. But we generally access web servers
by name, such as google.com. As you probably know, the browser consults an additional Internet
service called the Domain Name Service (DNS) to find its associated IP address and then uses it
to communicate with the computer.
For dynamic web pages, the procedure is a little more involved, because it may bring both PHP
and MySQL into the mix. For instance, you may click on a picture of a raincoat. The PHP will
put together a request using the standard database language, SQL—many of whose commands
you will learn in this book—and send the request to the MySQL server. The MySQL server will
return information about the raincoat you selected, and the PHP code will wrap it all up in some
HTML, which the server will send to your browser (see Figure 1-2).
(5)
Figure 1-2. A dynamic client/server request/response sequence
3. Your browser issues a request to that address for the web server’s home page.
4. The request crosses the Internet and arrives at the server.com web server.
5. The web server, having received the request, fetches the home page from its hard disk.
6. With the home page now in memory, the web server notices that it is a file incorporating
PHP scripting and passes the page to the PHP interpreter.
8. Some of the PHP contains SQL statements, which the PHP interpreter now passes to the
(6)
MySQL database engine.
9. The MySQL database returns the results of the statements to the PHP interpreter.
10. The PHP interpreter returns the results of the executed PHP code, along with the results
from the MySQL database, to the web server.
11. The web server returns the page to the requesting client, which displays it.
Although it’s helpful to be aware of this process so that you know how the three elements work
together, in practice you don’t really need to concern yourself with these details, because they all
happen automatically.
HTML pages returned to the browser in each example may well contain JavaScript, which will
be interpreted locally by the client, and which could initiate another request—the same way
embedded objects such as images would.
(7)
The Benefits of PHP, MySQL, JavaScript,
CSS, and HTML5
At the start of this chapter, I introduced the world of Web 1.0, but it wasn’t long before the rush
was on to create Web 1.1, with the development of such browser enhancements as Java,
JavaScript, JScript (Microsoft’s slight variant of JavaScript), and ActiveX. On the server side,
progress was being made on the Common Gateway Interface (CGI) using scripting languages
such as Perl (an alternative to the PHP language) and server-side scripting—inserting the
contents of one file (or the output of running a local program) into another one dynamically.
Once the dust had settled, three main technologies stood head and shoulders above the others.
Although Perl was still a popular scripting language with a strong following, PHP’s simplicity
and built-in links to the MySQL database program had earned it more than double the number of
users. And JavaScript, which had become an essential part of the equation for dynamically
manipulating Cascading Style Sheets (CSS) and HTML, now took on the even more muscular
task of handling the client side of the asynchronous communication (exchanging data between a
client and server after a web page has loaded). Using asynchronous communication, web pages
perform data handling and send requests to web servers in the background—without the web
user being aware that this is going on.
No doubt the symbiotic nature of PHP and MySQL helped propel them both forward, but what
attracted developers to them in the first place? The simple answer has to be the ease with which
you can use them to quickly create dynamic elements on websites. MySQL is a fast and
powerful, yet easy-to-use, database system that offers just about anything a website would need
in order to find and serve up data to browsers. When PHP allies with MySQL to store and
retrieve this data, you have the fundamental parts required for the development of social
networking sites and the beginnings of Web 2.0.
And when you bring JavaScript and CSS into the mix too, you have a recipe for building highly
dynamic and interactive websites, especially when there is now a wide range of sophisticated
frameworks of JavaScript functions you can now call on to really speed up web development,
such as the well-known jQuery, which is now probably the most common way programmers
access asynchronous communication features.
(8)
Using PHP
With PHP, it’s a simple matter to embed dynamic activity in web pages. When you give pages
the .php extension, they have instant access to the scripting language. From a developer’s point
of view, all you have to do is write code such as the following:
<?php
echo " Today is " . date("l") . ". ";
?>
The opening <?php tells the web server to allow the PHP program to interpret all the following
code up to the ?> tag. Outside of this construct, everything is sent to the client as direct HTML.
So the text Here's the latest news. is simply output to the browser; within the PHP tags, the
built-in date function displays the current day of the week according to the server’s system time.
PHP is a flexible language, and some people prefer to place the PHP construct directly next to
PHP code, like this:
Today is <?php echo date("l"); ?>. Here's the latest news.
There are even more ways of formatting and outputting information, which I’ll explain in the
chapters on PHP. The point is that with PHP, web developers have a scripting language that,
although not as fast as compiling your code in C or a similar language, is incredibly speedy and
also integrates seamlessly with HTML markup.
Note
If you intend to enter the PHP examples in this book to work along with me, you must remember
to add <?php in front and ?> after them to ensure that the PHP interpreter processes them. To
facilitate this, you may wish to prepare a file called example.php with those tags in place.
Using PHP, you have unlimited control over your web server. Whether you need to modify
HTML on the fly, process a credit card, add user details to a database, or fetch information from
a third-party website, you can do it all from within the same PHP files in which the HTML itself
resides.
(9)
Discovering Diverse Content Through
Random Scribd Documents
At this last sarcasm Mlle. de Soissons looked at the clock with a kind
of eager impatience, but said nothing.
"His magnificence is truly inconceivable," said M. de Lugeac. "It is
true that some say he is fortunate at play; others affirm that the
king and Madame Dubarry favor him in every way, and have gained
for him two very important lawsuits; besides, it is evident that his
Majesty is bewitched with him, as is all the world; and truly it may
be said that everything which this Marquis touches is turned to gold.
. . . If you will believe it, madame, he has brought into fashion a
poor devil of a tailor, who gave him credit in his earlier days; the
Marquis does not conceal it, but speaks of it quite freely. This
Landry, of The Golden Scissors, whose stores are brilliant, who is
now one of the richest artizans of Paris, owes his unlooked-for good
fortune only to the influence of these words, repeated by all the city:
'He is the tailor of the elegant Létorière!'"
"Truly!" said Madame Rohan-Soubise, impatiently, "all these stories
resemble the tales of Perrault."
"They are much more like fairy tales," replied M. de Lugeac. "And
then the description of his bedchamber! they say that his toilet set is
entirely of gold chased by Gouttière, and enriched with precious
stones." . . .
"And I," said the abbé, "I have heard a thousand times repeated by
the Archbishop of Paris that M. de Létorière was almost the serpent
of the terrestrial paradise. . . . 'If it were an affair of the government
of Paris,' said this good prelate to me this morning, 'I would mask
him with a cowl, like a black penitent, to hide his eyes, and choke
the sound of his voice; for, in a question of precedence which
interested one of my relations, this tempter has turned upside down
my whole chapter-house, and fascinated my prebendaries so that
they speak of nothing but him.'"
At this moment the door of the boudoir was thrown open, and a
valet-de-chambre announced with a loud voice: Monsieur the
Marquis de Létorière!
"M. de Létorière in my house! I have never received him! What
audacity!" cried Madame de Rohan-Soubise, with as much
astonishment as anger.
[1]See for these details, and for other biographical particulars of
Létorière, the charming Souvenirs de Madame la Marquise de
Créquy.
CHAPTER IX
THE DEPARTURE
CHAPTER X
"I wish to inform you, my dear baron, that the French Marquis
M. de Létorière will arrive to-day at your house to converse with
you on the subject of his lawsuit; I need not remind you of the
formal promise you have made me to add your vote to those of
your colleagues, in favor of the Duke of Brandenbourg. Believe
me, my dear baron, etc."
"And what the devil is this Frenchman coming here for?" cried the
governor, in a passion. "By the Holy Kings of Cologne, am I never to
have one moment of repose? Here is this beau of Versailles coming
to rouse me like a wild boar from his lair. . . . In my opinion his
lawsuit is lost . . . totally lost. . . . What does he want more? Does
he believe that I am going to interest myself about him? An
impudent little fellow, who embroiders in tambour, and who uses,
they say, rouge and patches! One of these men of gallantry, as
corrupt as effeminate, always hanging on the skirts of the women!
But, by the infernal, I can't escape from this Marquis! If he comes, I
shall be obliged to offer him hospitality; it is fifteen leagues from
here to Vienna, and I can't send him back without seeing him! I wish
the devil had all the lawyers and lawsuits! and he's coming to-night!
We must offer him a bed; but where shall he sleep? Everything is
dilapidated here, and this beauty will come in a litter, like a woman
in labor!"
The baron stamped his foot in anger, and calling his major-domo,
said with an air of vexation:
"Perhaps we shall have a Frenchman here to-night—a Marquis—a
pleader;—in such weather we cannot let him go back to Vienna.
Where can we put him, him and his suite? For this dandy
undoubtedly travels with his train of hair-dressers, bathers and
perfumers!"
"Faith, my lord," said the major-domo, scratching his ear, "there is
only the rat-chamber, where the rain does not come in."
"Well then, put him in the rat-chamber." Then the baron added, with
a sort of bitter irony: "In order to convey a brilliant impression of the
hospitality bestowed at the castle of Henferester, and especially that
this delicate visitor may have all his comforts, don't forget, major-
domo, to cover his bed with the most beautiful silk curtains, to
furnish it with eider-down, and the finest linens of Friesland; to beat
well the Turkey carpet; to put perfumed candles into the silver-gilt
candlesticks, and to warm his bed with charcoal of aloes wood. Do
you understand, major-domo?"
"Yes, yes, my lord," said Martin Selbitz, busily occupying himself with
dishing up the quarter of venison, the bacon and the sauer-kraut,
and rejoiced at the peasantry of his master; "yes, my lord, be easy;
I understand you; the straw of his bed shall be fresh, and well
stirred up; the woollen coverlid well beaten, the floor well swept, the
curtains and tapestry of cobwebs well shaken, and the shutters set
wide open, that the moon may throw a bright light into the chamber
of your guest; in short, if he is so delicate and sensitive to cold, his
bed shall be warmed,—by the dog of the turnspit."
The baron could not help laughing at the factiousness of his major-
domo, who had so exactly described the rat-chamber, which was
very like his own apartment, so indifferent was he to the commonest
conveniences of life.
"To supper!" said the governor, drawing up his chair and taking his
hunting-knife from his belt.
At this moment was heard the sound of the trumpet, habitually used
by German postilions.
"Perhaps it is that confounded Marquis," cried the baron. "Hullo,
Erhard, Selbitz, run to receive him!"
The governor, rising heavily from his seat, went to the door, saying
in a growling tone: "He must have a devilish strong body to travel
such weather as this. . . . Bah, shut up in his post-chaise, he is much
better off than he will be in the castle. Let us see, then, this
beautiful darling, this beau, this most effeminate of all the
effeminates in the Court of France."
And the governor went forward to fulfil, in spite of himself, the
duties of hospitality towards his guest.
CHAPTER XI
THE SUPPER
CHAPTER XII
CONFIDENCES
The next day, on rising, the baron learned from Selbitz that the
Marquis had set out at daylight with Erhard Trusches, for the woods,
and had charged the major-domo to make his excuses to the
governor.
"Who would have thought, considering the reputation of the
Marquis, to find him such a hard huntsman and drinker, Selbitz? For,
do you know, he was ahead of me at table, and we valiantly emptied
our tankards," said the baron.
"Yes, my lord, and he went up to the rat-chamber with as firm a step
as if he had drunk nothing but a little whey for supper."
"Well, well," said the baron, receiving from the hands of his major-
domo what was necessary to dress himself for the chase, "well,
Selbitz, we must allow that, after all, the Marquis is a brave and
worthy gentleman, and besides, is gay enough to rejoice your heart!
What good stories he told us. . . . I wish he was going to pass
several days at the castle! for, on my faith, he's a most agreeable
companion. Although there is more than twenty years difference in
our ages, we seem to be old acquaintances; in short, if he were not
an acquaintance of yesterday, I should say—and devil take me if I
know why—I should say, Selbitz, that I feel a great friendship for
him; faith, I like frank and open characters,—there's nothing equal
to them!"
After hastily eating a slice of cold venison, a porringer of beer-soup,
and drinking two pints of Rhine wine, the baron mounted his horse,
and soon reached the rendezvous which he had appointed with
Erhard Trusches, in one of the cross-ways of the forest.
He found there his huntsman, his servant, and the pack.
Erhard Trusches appeared sad and absorbed; the baron, surprised at
not seeing Létorière at the rendezvous, questioned Erhard about
him.
After a moment's silence, Erhard said, with a timid and uneasy air,
"Is my lord well acquainted with his guest?"
"What do you mean, Erhard? Where is the Marquis? Did he not come
with you this morning to the wood?"
"Yes, my lord, that is why I ask you if you are sure of him. See here,
my lord, it will bring me mischief, joking last night at supper about
the blessing."
"Ah! explain yourself!"
"I mean to say, my lord"—and Erhard went on with a low and
trembling voice—"I very much fear that your guest is he who
appears sometimes in the moonlight, in the solitary recesses of the
forest, to offer to desperate huntsmen three balls, one of gold, one
of silver, and one of lead, and the whole at the price of their souls!"
added Erhard, with a gloomy and frightened air.
"So! you take my guest for the devil, then," cried the baron,
shrugging his shoulders and laughing; "your morning cup has turned
your brain, old Erhard!"
The huntsman shook his head, and replied: "My lord, explain to me
how it is that he whom you call your guest, and who has never been
in this forest before, knows it as well as I do."
"What do you mean to say?" said the baron, very much astonished.
"This morning at daylight, when I started with the Marquis, 'Master
Erhard,' said he to me, 'if you will let me take a hound, we will share
the search of the forest. I will go over the enclosures of the priory of
the Hermit's Chapel, of the Thunder-struck Fir-tree, and of the Black
Pool.'"
"He said that?" said the baron, stupefied.
"Just as I have told you, my lord, and he added: 'I have great hope
of starting a full-grown buck, for, in the woods about the Hermit's
Chapel, stags are plenty. You, Master Erhard, on your part, seek to
start a wild boar. They are always to be found in the forests of
Enrichs, the brambles are so thick. Then the baron can have his
choice between the foot of the stag or the track of the wild boar.'
'But, sir,' I said, affrighted, 'you know our forests well, then? you
have often hunted them?' 'I have never hunted here,' he answered,
'but I know it as well as you do. Go ahead! good luck, Master
Erhard!'—and then he disappeared in the woods, taking with him
poor Moick, our best boar-hound, whom lie will perhaps change into
a lynx, or a beast with seven paws, by his diabolical witchcraft."
The baron was not at all superstitious, but he could not comprehend
what Erhard said, and he knew him to be too respectful to joke with
his master. Nevertheless, he could not but admit that the Marquis
was endowed with such topographical knowledge as the huntsman
described.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookfinal.com