Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (6 votes)
23 views

Download ebooks file (Ebook) A Web-Based Introduction to Programming: Essential Algorithms, Syntax, and Control Structures Using Php, Html, and Mariadb/MySQL by Mike O’kane ISBN 9781531002749, 1531002749 all chapters

The document is a promotional overview of various eBooks available for download on ebooknice.com, including titles on programming, cooking, mathematics, and history. It highlights a specific eBook, 'A Web-Based Introduction to Programming' by Mike O'Kane, which covers essential algorithms, syntax, and control structures using PHP, HTML, and MariaDB/MySQL. The document also includes information about the author and the book's content structure, emphasizing its instructional value and the importance of programming languages.

Uploaded by

lizakiaricel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (6 votes)
23 views

Download ebooks file (Ebook) A Web-Based Introduction to Programming: Essential Algorithms, Syntax, and Control Structures Using Php, Html, and Mariadb/MySQL by Mike O’kane ISBN 9781531002749, 1531002749 all chapters

The document is a promotional overview of various eBooks available for download on ebooknice.com, including titles on programming, cooking, mathematics, and history. It highlights a specific eBook, 'A Web-Based Introduction to Programming' by Mike O'Kane, which covers essential algorithms, syntax, and control structures using PHP, HTML, and MariaDB/MySQL. The document also includes information about the author and the book's content structure, emphasizing its instructional value and the importance of programming languages.

Uploaded by

lizakiaricel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

Download Full Version ebook - Visit ebooknice.

com

(Ebook) A Web-Based Introduction to Programming:


Essential Algorithms, Syntax, and Control
Structures Using Php, Html, and Mariadb/MySQL by
Mike O’kane ISBN 9781531002749, 1531002749
https://ebooknice.com/product/a-web-based-introduction-to-
programming-essential-algorithms-syntax-and-control-
structures-using-php-html-and-mariadb-mysql-10011484

Click the button below to download

DOWLOAD EBOOK

Discover More Ebook - Explore Now at ebooknice.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason;


Viles, James ISBN 9781459699816, 9781743365571,
9781925268492, 1459699815, 1743365578, 1925268497
https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374

ebooknice.com

(Ebook) Matematik 5000+ Kurs 2c Lärobok by Lena


Alfredsson, Hans Heikne, Sanna Bodemyr ISBN 9789127456600,
9127456609
https://ebooknice.com/product/matematik-5000-kurs-2c-larobok-23848312

ebooknice.com

(Ebook) SAT II Success MATH 1C and 2C 2002 (Peterson's SAT


II Success) by Peterson's ISBN 9780768906677, 0768906679

https://ebooknice.com/product/sat-ii-success-
math-1c-and-2c-2002-peterson-s-sat-ii-success-1722018

ebooknice.com

(Ebook) Cambridge IGCSE and O Level History Workbook 2C -


Depth Study: the United States, 1919-41 2nd Edition by
Benjamin Harrison ISBN 9781398375147, 9781398375048,
1398375144, 1398375047
https://ebooknice.com/product/cambridge-igcse-and-o-level-history-
workbook-2c-depth-study-the-united-states-1919-41-2nd-edition-53538044

ebooknice.com
(Ebook) Master SAT II Math 1c and 2c 4th ed (Arco Master
the SAT Subject Test: Math Levels 1 & 2) by Arco ISBN
9780768923049, 0768923042
https://ebooknice.com/product/master-sat-ii-math-1c-and-2c-4th-ed-
arco-master-the-sat-subject-test-math-levels-1-2-2326094

ebooknice.com

(Ebook) Essential algorithms : a practical approach to


computer algorithms using Python and C# by Rod Stephens
ISBN 9781119575993, 1119575990
https://ebooknice.com/product/essential-algorithms-a-practical-
approach-to-computer-algorithms-using-python-and-c-12274474

ebooknice.com

(Ebook) Dasar-Dasar dan Step by Step Four in One Web


Programming (HTML, JavaScript, PHP dan MYSQL) by Marvin
Chandra Wijaya
https://ebooknice.com/product/dasar-dasar-dan-step-by-step-four-in-
one-web-programming-html-javascript-php-dan-mysql-47309128

ebooknice.com

(Ebook) The Essential Guide to CSS and HTML Web Design by


Craig Grannell ISBN 9781590599075, 1590599071

https://ebooknice.com/product/the-essential-guide-to-css-and-html-web-
design-43141960

ebooknice.com

(Ebook) Essential Algorithms: A Practical Approach to


Computer Algorithms Using Python and C#- Second Edition by
Rod Stephens ISBN 9781119575993, 1119575990
https://ebooknice.com/product/essential-algorithms-a-practical-
approach-to-computer-algorithms-using-python-and-c-second-
edition-57280052
ebooknice.com
A Web-Based Introduction
to Programming

2
A Web-Based Introduction
to Programming

3
Essential Algorithms, Syntax,
and Control Structures Using PHP, HTML,
and MariaDB/MySQL

Fourth Edition

Mike O'Kane

4
Copyright © 2017
Mike O'Kane
All Rights Reserved.

Library of Congress Cataloging-in-Publication Data

Names: O'Kane, Mike, 1953- author.


Title: A web-based introduction to programming : essential algorithms,
syntax, and control structures using PHP, HTML, and MariaDB/MySQL / Mike
O'Kane.
Description: Durham, North Carolina : Carolina Academic Press, [2017] |
Includes bibliographical references and index.
Identifiers: LCCN 2017017694 | ISBN 9781531002749 (alk. paper)
Subjects: LCSH: Computer software--Development. | Internet programming. |
Computer programming--Web-based instruction. | PHP (Computer program
language) | XHTML (Document markup language)
Classification: LCC QA76.76.D47 O43 2017 | DDC 005.3--dc23
LC record available at https://lccn.loc.gov/2017017694

eISBN 978-1-53100-707-2

Carolina Academic Press, LLC


700 Kent Street
Durham, North Carolina 27701
Telephone (919) 489-7486
Fax (919) 493-5668

www.cap-press.com

Printed in the United States of America.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any
means, electronic, mechanical, recording or otherwise, without the prior written permission of the author.

Please note: The information in this book is provided for instructional value and distributed on an “as is” basis,
without warranty. While every precaution has been taken in the preparation of the book, neither the author nor
Carolina Academic Press shall have any liability to any person or entity with respect to any loss or damage caused
by or alleged to be caused, directly or indirectly, by the instructions contained in this book or by the programs or
applications that are listed in, or provided as supplements to, this book.

Macintosh®, Mac OS®, Safari, and iOS® are registered trademarks of Apple, Inc. in the United States and other
countries. Windows® and Windows Mobile® are registered trademarks of Microsoft Corporation in the United
States and other countries. Linux® is the registered trademark of Linus Torvalds in the United States and other
countries. MySQL® is a registered trademark of Oracle Corporation and/or its affiliates. MariaDB® is a registered
trademark of MariaDB Corporation Ab. Mozilla® and Firefox® are registered trademarks of the Mozilla
Foundation. Joomla!® is trademarked by Open Source Matters. Apache® is a trademark of the Apache Software
Foundation. XAMPP and Apache Friends are registered trademarks of BitRock. The WordPress® trademark is
owned by the WordPress Foundation. Android® and Google Chrome® are trademarks of Google Inc. The Drupal®
trademark is owned and controlled by Dries Buytaert. BlackBerry® is a trademark of Blackberry. All product
names identified in this book are trademarks or registered trademarks, and are the properties of their respective
companies. We have used these names in an editorial fashion only, and to the benefit of the owner, with no

5
intention of infringing the trademark.

6
To my dear mother and father,
thank you for the love and light that you bestowed on us.

7
Contents

Preface
Acknowledgments
About the Author

Chapter 1 · Introducing Computer Programming


Introduction
What Is a Computer Program?
What Do Programmers Do?
The Software Development Life Cycle
The Importance of Writing and Communicating
What Are Programming Languages?
Compilers and Interpreters
So Many Languages!
Standalone and Network Applications
Markup Languages
Combining Markup and Programming Languages
Summary
Chapter 1 Review Questions

Chapter 2 · Client/Server Applications—Getting Started


Introduction
Client/Server Design in Web Applications
Working with Files and Folders
Locating Files and Folders on Computers Running a Windows Operating System
Locating Files and Folders on the Internet
Internet Naming Conventions for Files and Folders
Working with a Local Web Server
What Languages Will I Use?
What Software Will I Need?
Installing a Text Editor
Installing One or More Web Browsers
Installing Your Web Server
Using Your Web Server
Using URLs with Your Web Server
Always Use URLs to Run Your Web Applications!
Where to Save Your Work Files
The Importance of Frequent Backups
Creating an HTML Document
Creating a PHP program

8
Creating an Interactive HTML and PHP Program
Summary
Chapter 2 Review Questions
Chapter 2 Code Exercises

Chapter 3 · Program Design—From Requirements to Algorithms


Introduction
What Are Instructions?
Common Characteristics of Instructions
Sequence, Selection and Repetition Structures
A Programming Example
Creating an Input, Processing, Output (IPO) chart
Designing the User Interface
Developing an Algorithm
A Smoking Calculator
Coding the Application
Summary
Chapter 3 Review Questions
Chapter 3 Code Exercises

Chapter 4 · Basics of Markup—Creating a User Interface with HTML


Introduction
A Short History of HTML
Introducing HTML Tags
Ignoring White Space
More HTML Tags
Introducing HTML Tables
Using HTML Tables to Layout Web Pages
Other HTML Tags
Deprecated HTML Tags
Introducing Style Sheets
Multiple Styles for a Single Tag
Selecting Colors for Fonts and Backgrounds
Referencing a Style Sheet in Your HTML Document
Applying a Style Sheet to Multiple Pages
Interactive User Interfaces
Creating HTML Forms
Using HTML Forms to Obtain User Input
Using HTML Tables to Line Up Prompt and Input Boxes
Problems with Form Submission
Drop Down Lists
Combining Textboxes and Drop Down Lists
Other Types of Input
Stylesheets and Forms

9
Summary
Chapter 4 Review Questions
Chapter 4 Code Exercises

Chapter 5 · Creating a Working Program—Basics of PHP


Introduction
Why PHP?
Working with HTML and PHP
Important Features of Client/Server Programs
Receiving Input from a Form — wage2.php
Processing the Smoking Survey — smoking.php
PHP — General Guidelines and Syntax
Arithmetic Expressions
Using Arithmetic Functions
White Space in PHP Files
Generating Character Strings from PHP
Including Double Quotes in Character Strings
Using Multiple PHP Sections
Using the number_format() Function to Display Numbers to a Specific Number of Places
Including Calls to PHP Functions inside PHP Print Statements
String Concatenation and the Concatenation Operator
The PHP Echo Statement
Finding Syntax Errors
Finding Logical Errors
Summary
Chapter 5 Review Questions
Chapter 5 Code Exercises

Chapter 6 · Persistence — Saving and Retrieving Data


Introduction
The Difference Between Persistent and Transient Data
Files and Databases
Working with a Text File
Closing a Text File
Reading Data from a Text File
PHP Functions to Read Data from a Text File
Writing Data to a Text File
PHP Functions to Write Data to a Text File
Be Careful to Avoid Security Holes!
Using Escape Characters
Escape Characters and HTML Tags
Using PHP to Append Data to Files
PHP Functions to Append Data to a Text File
Processing Files that Contain Complete Records on Each Line

10
Visit https://ebooknice.com to
discover a wide range of
eBooks across various genres.
Enjoy exclusive deals and
discounts to enhance your
reading experience. Start your
digital reading journey today!
PHP Functions to Parse a Delimited Character String
Processing a File with Multiple Records
Appending Records to a File
Working with Multiple Files
Summary
Chapter 6 Review Questions
Chapter 6 Code Exercises

Chapter 7 · Programs that Choose — Introducing Selection Structures


Introduction
Introducing IF and IF..ELSE Structures
Introducing Flow Charts
Boolean Expressions and Relational Operators
Selection Using the IF Structure
Testing Threshold Values
Selection Using the IF..ELSE Structure
When to Use Braces in IF..ELSE Statements
Creating a Program with Multiple but Independent Selection Structures
Comparing Strings — Testing for a Correct Password
Ignoring the Case of a Character String
Providing a Selective Response
Using Selection to Construct a Line of Output
Summary
Chapter 7 Review Questions
Chapter 7 Code Exercises

Chapter 8 · Multiple Selection, Nesting, ANDs and ORs


Introduction
Introducing the Logical Operators AND and OR
Introducing the NOT Operator
Validating User Input
Using A Nested Selection Structure to Validate Input
Designing Applications with Nested Selection Structures
Use of Braces in Nested Selection Structures
Chaining Related Selection Structures
Additional Input Validation Using Chained Selection Structures
More about Input Validation: Using the trim() Function
When to Use AND or OR? Be Careful with Your Logic!
The Challenge of Software Testing
A Special Case: The Switch Statement
More Examples in the Samples Folder
Some Words of Encouragement
Summary
Chapter 8 Review Questions

11
Chapter 8 Code Exercises

Chapter 9 · Programs that Count — Harnessing the Power of Repetition


Introduction
Controlling a Loop by Counting
Coding a FOR Loop in PHP
General Syntax of a FOR Loop
Including the Counting Variable in Your Loop Statements
Using a Variable to Control the Loop Condition
Converting from Celsius to Fahrenheit
Changing the Increment Value
Using Loops with HTML Tables
Allowing the User to Control the Loop
Improving Processing Efficiency
Using Loops to “Crunch Numbers”
Using a Loop to Accumulate a Total
Finding the Total and Average from a File of Numbers
Finding the Highest and Lowest Values in a Series
Performing Multiple Operations on a File of Numbers
Nesting IF..ELSE Structures to Customize Output from a Loop
Loops within Loops — Creating a Bar Chart
Selecting from a List of Data Files
Summary
Chapter 9 Review Questions
Chapter 9 Code Exercises

Chapter 10 · “While NOT End-Of-File”—Introducing Event-Controlled Loops


Introduction
Characteristics of WHILE Loops
The Structure of WHILE Loops
An Algorithm to Process Files of Unknown Length
Using a WHILE Loop to Process a File of Scores
Including Selection Structures Inside a WHILE Loop
Using a WHILE Loop to Count, Sum and Average Data
Using a WHILE Loop to Process a File of Records
Processing Weekly Wages from a File of Timesheet Records
Processing Selected Records from a File of Timesheet Records
Processing Selected Fields from a File of Records
Processing a File of Survey Data
Using DO..WHILE or REPEAT..UNTIL Loops
Summary
Chapter 10 Review Questions
Chapter 10 Code Exercises

12
Chapter 11 · Structured Data — Working with Arrays
Introduction
What Is an Array?
Working with Array Elements
Extending an Array
Displaying Array Values
Receiving Scores into an Array from an HTML Form
Arrays of Strings
How Large Is the Array?
Why Do Array Indices Begin with 0 and Not 1?
Using FOR Loops with Arrays
Using the sizeof() Function to Control a FOR Loop
Summing and Averaging the Values in an Array
Counting Selected Values in an Array
Multiple Operations on an Array
Reading Data from a File into an Array
Reading Data into an Array from a File of Unknown Length
Using [] with no Index Value
Reading Selected Data from a File into an Array
Reading Data from a File into Multiple Arrays
Reading Selected Data from a File of Records into an Array
More About the explode() and list() Functions
A Special Loop for Processing Arrays — FOREACH
Multi-Dimensional Arrays
Summary
Chapter 11 Review Questions
Chapter 11 Code Exercises

Chapter 12 · Associative Arrays


Introduction
Using a Variable to Reference the Key of an Associative Array
Using Associative Arrays as Lookups
Using the array() Function to Create Associative Arrays
Associative Arrays and the FOREACH Loop
More about the $_POST Array
Using the isset() Function to Combine a Web Form with the Form Processing Code in a Single Page
Web Sessions and the $_SESSION Array
Adding Code to Manage a Web Session
Creating, Initializing and Modifying Session Variables
Validating $_SESSION and $_POST Arrays
Revisiting the Same Page in a Web Session
Summary
Chapter 12 Review Questions

13
Chapter 12 Code Exercises

Chapter 13 · Program Modularity — Working with Functions


Introduction
Using Functions
Understanding Function Arguments
Receiving Values from a Function
Researching Available Functions
Reasons to Use Pre-Defined Functions
Using die() or exit() to Terminate an Application
Creating Your Own Functions
Where Do I Put My Functions?
Creating a Library of Functions
Including Functions from External Files
Using the Same Functions in Different Programs
Functions Calling Functions
Learning to Think Beyond Specific Applications
More about Include Files
Summary
Chapter 13 Review Questions
Chapter 13 Code Exercises

Chapter 14 · Connecting to a Database — Working with MySQL


Introduction
What Is a Relational Database?
The Relational Database Management System (RDBMS)
Structured Query Language — MySQL
Starting Your MySQL Server
Configuring MySQL for Use with This Textbook
Three Ways to Work with MySQL
Working with PHP and MySQL
Using PHP to Open and Close a Connection to a MySQL Server
Using the MySQL SELECT Query
Selecting Specific Records
Relational Operators in MySQL
The Logical Operators AND and OR
Ordering Your Query Results
Viewing Your Query Results
Using an HTML Table to Display the Query Results
Putting It All Together
Using Input from an HTML Form to Construct a Query
Processing Queries with a Single Result
Performing Calculations with the Result Set
Performing Aggregate Operations on MySQL Queries

14
Performing JOIN Operations on Multiple Tables
Using INSERT to Add Records to a Table
Using UPDATE to Modify a Record
Removing a Record
Storing MySQL Connection Data in an Include File
Creating, Dropping, and Altering Databases and Tables
Summary
Chapter 14 Review Questions
Chapter 14 Code Exercises

Chapter 15 · Introduction to Object-Oriented Programming


Introduction
What is an Object?
Creating and Using Instances of a Class
Using Employee Objects in an Application
Defining an Object
Coding the Object Class
Creating and Using Instances of an Object Class
The Class Constructor Method
Method Overloading
Why do Objects Matter?
Object Design and Inheritance
Abstract Classes and Methods
Method Over-riding
Polymorphism
OOP and Databases
OOP Development
OOP Languages
Summary
Chapter 15 Review Questions
Chapter 15 Code Exercises

Chapter 16 · Where to Go from Here . . .


Introduction
Moving Forward with PHP and HTML
More about PHP
PHP and Other Languages
XHTML and XML
Client Side Processing with Javascript and Ajax
The Importance of OOP
IDE's, Modeling Languages and Frameworks
Client/Server and Server/Server Programming
Mobile Applications
Digital Media

15
Graphical User Interfaces and Interface Design
Web Design and Content Management
Database Programming and SQL
In Summary: Follow Your Heart!

Appendix A · Data Representation and Formats


Introduction
Storing Data in Bits and Bytes
How Multimedia Data Is Represented in Binary
How Numeric Values Are Represented in Binary
How Plain Text Is Represented in Binary
How Source Code and Markup Code Is Represented in Binary
How Program Instructions Are Represented in Binary
How Memory Addresses Are Represented in Binary
What Else Can Be Represented in Binary?

Appendix B · Files, Folders, Addressing Schemes, and Command Line Arguments


File Types and File Extensions
Disk and Disk Drives
Files and File Folders (Directories)
Naming Files and Folders
File Addresses in Windows and on the Web
Relative Addresses in Windows
Relative Addresses on the Internet
Using Relative Web Addresses in HTML Code
Managing Files at the Command Line
Introduction to MS DOS Commands
Recalling Previous Commands
Use Double Quotes when Paths Include Spaces
Printing the Contents of the Console Window
Creating Batch Files
Unix Commands

Appendix C · Installing and Running Your Standalone Web Server


Using an Active Web Server
Problems Using Your Web Server
Advanced Users

Appendix D · Debugging Your Code


Problems Viewing Your HTML or PHP Programs
Problems with HTML Layout
Locating PHP Syntax Errors
Common PHP Syntax Errors
Common Logical Errors

16
Appendix E · More about HTML and CSS
Useful HTML References
Useful CSS References
Inline Styles and Internal Style Sheets
Deprecated HTML Tags
Frequently Asked Questions Regarding HTML Tags

Appendix F · More about PHP Functions and Data Types


Useful PHP References
More about PHP Functions and Data Types
Standard PHP Array Functions
Standard PHP File Functions
Standard PHP Math Functions
Standard PHP String Functions
PHP Data Types

Appendix G · Additional PHP Operators and Control Structures


Shortcut Operators
Switch Structure
Another Loop Structure: DO..WHILE
Multi-Dimensional Arrays
Ragged Arrays
Multi-Dimensional Associative Arrays

Index

17
Preface

The problem I have tried to solve with this textbook is, quite simply, how to effectively introduce general
programming concepts to students who have never programmed before. Perhaps like me, you have found yourself
frustrated by textbooks that try to cover too much too fast, make inappropriate assumptions about what a student
already knows, or take sudden leaps in complexity when providing examples and exercises.
I believe that the purpose of an introductory programming course is to help students gain confidence and
develop their understanding of basic logic, syntax, and problem-solving. They do not need to learn all aspects of a
language or even learn best practices—these are topics for the next course level. The question is: how to provide
the kind of hands-on experience that supports active learning without overwhelming the beginning student with
too much syntactical and programmatic detail?
I have tried many approaches over the years before settling on a Web-based approach, using PHP, CSS, and
HTML code to develop small, interactive Web applications. This approach has proved very successful. Many
students report how much they enjoy the course, how much they have learned, and how well the material has
served them in subsequent courses and in their professional life. I also hear from many students who tell me that
the course positively changed their opinion of programming as a career or subject of interest, which is most
gratifying.
Some instructors may have concerns that my coverage of the PHP and HTML is insufficient. The book uses a
small number of HTML tags, CSS rules, and PHP functions, and employs some arbitrary conventions to simplify
the code and keep the focus on basic concepts common to most languages. For example, PHP print statements
are used rather than echo statements, and these statements always include parentheses and double quotes so that
the syntax is more consistent with the output statements of most other languages. The last chapter (“Where to Go
From Here”) clarifies which practices are standard and which are particular to the textbook.

18
Intended Audience
The book is designed to serve:

Instructors teaching introductory programming, programming logic and design, or Web programming
courses, who want a textbook that engages students and provides a solid preparation for subsequent courses,
but avoids overwhelming beginners with too much syntactical detail or program complexity.
Traditional and online students taking a first course in programming, programming logic and design, or
Web programming.
Web designers, graphic artists, technical communicators, and others who find that their work increasingly
requires some degree of programming expertise, and need an effective, hands-on introduction.
Others who wish to learn the basics of programming, either for personal interest, or to explore the
possibility of a career in this field.

Note that solutions to quizzes and exercises are only available to verified course instructors.

19
Approach
The book takes a fairly novel approach, allowing students to learn program logic and design by developing a large
number of small Web-based applications. Students love working with the Web, and this approach has other
important benefits:

Important concepts such as client/server design, server-side processing, and interface-driven code modules
can be introduced in the form of working applications, and then applied in hands-on exercises.
Students not only learn the essential control structures and syntax of a programming language, but also learn
to use a markup language (and associated style sheets), and a database query language to access and query a
database. This makes sense in today's programming environment where these languages are routinely used
in combination to develop a networked application.
The material is relevant to students across a range of disciplines: Computer Science, Information Systems,
Technical Communications, Network Systems, Digital Media, Web Technologies, Mobile Applications,
Database Programming, and other technology-related fields.
The focus on hands-on problem-solving and fundamental structures prepare students for next-level,
language-specific courses such as PHP, Python, Java or C++, as well as Web design and database courses,
without replicating a great deal of material, while the syntax covered here is generally consistent with these
and other languages.

The book makes use of a programming language (PHP), a scripting language (HTML), a style sheet language
(CSS), and a database query language (MariaDB or MySQL), but does not attempt to provide a complete
overview of these languages. Instead, students learn sufficient syntax to convert requirements into working
applications using basic programming structures, arithmetic and logical expressions, user interfaces, functions,
data files, and SQL queries. The focus remains on basic concepts, logic and design, algorithm development, and
common programming procedures. The book provides context throughout, explaining why each topic is
important, and referring students to related career paths.
Although the book focuses on Web-based applications, there is NO requirement for a network-based
programming environment. The book uses a fully functional but standalone Apache Web server (the open source
xampp distribution provided by the Apache Friends group) that students can install on a USB drive or home
computer simply by unzipping a file. Students can begin programming in HTML, PHP and MariaDB or
MySQL in literally minutes.

20
Visit https://ebooknice.com to
discover a wide range of
eBooks across various genres.
Enjoy exclusive deals and
discounts to enhance your
reading experience. Start your
digital reading journey today!
Features
Each chapter begins with clearly stated learning outcomes. Each topic is introduced using examples of simple
program requirements that are first developed as algorithms and interfaces and then realized in working code.
Code statements and control structures are explained step by step.
Different programming topics are treated in separate chapters. Even topics that are commonly combined, such
as counting loops and event-controlled loops, have their own chapters so that students have the chance to develop
and apply their understanding of each separately.
Each chapter includes quizzes that have been carefully developed to test the student's understanding of the
chapter's learning outcomes. The questions have been tested extensively in the classroom.
Three different types of coding exercise are provided at the end of each chapter:

Fixit exercises provide small programs that include a single error of some kind. These exercises help students
improve their problem-solving ability, test their understanding of key concepts, and develop tracing and
debugging skills.
Modify exercises provide working programs that must be modified to perform a somewhat different or
additional function. These exercises help students determine how and where to add new code, and test their
ability to read and understand existing code.
Code completion exercises allow students to apply concepts and tools covered in the chapter by developing
new applications. These exercises test the student's ability to: understand requirements, develop algorithms,
and produce working code. The code completion exercises follow consistent themes that are developed
throughout the book, so that students can more readily appreciate the value of new functionalities that they
learn in each chapter.

Templates for each exercise contain partially completed code so students don't waste time typing (and debugging)
code that is not relevant to the problem at hand. The templates also help instructors to streamline the grading
process.
The textbook comes with a standalone Web server that can be installed on a fixed or portable drive simply by
unzipping a file (so students can bring the software with them to work on computers at any location).
The server installation includes textbook folders that contain all code samples and exercise templates. Students
can complete the exercises simply by opening, editing, and saving the appropriate files. Assignments can be turned
in simply by zipping and submitting the appropriate chapter folder.
The textbook appendices provide additional learning resources designed to: (a) help individual students with
particular needs or interests (for example file/folder management, additional references, and help debugging
code); and (b) deliver useful topics not included in the chapters (for example data representation, additional
control structures, and multi-dimensional arrays).

21
Textbook Web Site
The textbook Web site ensures that both students and instructors have access to the most current resources
associated with this textbook. The Web site includes: everything you need to install and use the Web server; slide
presentations; and hints and help for students working through each chapter. The Web site also provides support
for verified instructors, including additional exercises, test banks, slide presentations, quiz solutions, code
solutions, and other instructional resources. The Web site can be found at:
http://www.mikeokane.com/textbooks/WebTech/

22
Changes to the Fourth Edition
In addition to minor corrections and improvements, this fourth edition of the book includes: a new install of the
xampp Apache Web server distribution with installation instructions for Windows, Mac OS, and Linux; revised
file naming conventions that are more standard for current web development; a hopefully improved redesign of
Chapters 7 and 8; additional materials and improvements to Chapter 13 (functions); references to both MySQL
and MariaDB in Chapter 14 (the actual code and descriptions are identical); a new Chapter 15 that introduces
Object-Oriented Programming.

23
Chapter Overview
Chapter 1: Introducing Computer Programming. Students learn the relationship between machine language
and high-level languages, and review common tasks that computer programs typically perform. The work of a
programmer is described, and the software development cycle is explained. The chapter highlights and briefly
summarizes design approaches such as algorithm development, interface design, client/server design and object-
oriented programming. Different programming languages are identified, and the distinction is made between
interpreted and compiled languages, and between markup and programming languages. Standalone and network
applications are also contrasted.
Chapter 2: Client/Server Applications—Getting Started. This chapter prepares students for the hands-on
work they will perform in subsequent chapters. File types and local and Internet addressing schemes are explained.
Instructions are provided to install, run, and test the required software. Students are shown how to create, store,
and run a number of sample applications in order to become familiar with the process of using a text editor,
saving files, running the Web server, and viewing the results in a Web browser.
Chapter 3: Program Design—from Requirements to Algorithms. The general characteristics and
requirements of effective instructions are explored, using human and program examples. Students walk through
the process of reviewing simple requirements, creating input, processing, and output (IPO) charts, designing the
interface, and developing solution algorithms. The chapter introduces sequence, selection and control structures,
variables and assignment operations, and arithmetic and logical expressions.
Chapter 4: Basics of Markup—Creating a User Interface with HTML. This chapter explains the significance
of data rendering, and provides a brief overview and history of Hypertext Markup Language (HTML).
Commonly used HTML tags are explained, and the student is shown how to apply these to create and organize
simple Web pages. Cascading style sheets are introduced. Students are shown how to create HTML forms to
obtain user input as a first step in developing interactive Web applications. HTML Tables are used to perform
simple form layout.
Chapter 5: Creating a Working Program—Basics of PHP. This chapter teaches sufficient PHP language
syntax to process user input received from HTML forms, perform simple arithmetic, and produce formatted
output. In the process, students learn to code arithmetic expressions, use standard operators and functions, create
and work with variables, and identify and fix both syntax and logical errors.
Chapter 6: Persistence—Saving and Retrieving Data. This chapter explains the difference between persistent
and transient data, and introduces text file processing as well as basic database concepts. Students learn to: open,
read, write, and close text files; work with multiple files; parse lines of data that contain multiple values separated
by some kind of delimiter.
Chapter 7: Programs that Choose—Introducing Selection Structures. This chapter introduces selection
control structures and demonstrates the use of algorithms to solve problems requiring simple selection. Students
learn to use IF and IF..ELSE structures, Boolean expressions, relational operators, truth tables, simple string
comparisons, and testing procedures.
Chapter 8: Multiple Selection, Nesting, ANDs and ORs. This chapter develops examples from Chapter 7 to
handle problems associated with input validation and more complex requirements. Students explore the use of
compound Boolean expressions, nested selection structures, chained IF..ELSEIF..ELSE selection structures, and
multiple but independent selection structures.
Chapter 9: Programs that Count—Harnessing the Power of Repetition. This chapter introduces loop
structures with a focus on count-controlled FOR loops. Students learn how to refer to the counting variable
within the loop, and how to use loops to generate tables, crunch numbers, accumulate totals, find highest and
lowest values in a series, select values from a file of records, and display bar charts.
Chapter 10: “While NOT End-Of-File”—Introducing Event-Controlled Loops. This chapter introduces
WHILE loops and demonstrates the use of the priming read and the standard algorithm to process files of
unknown length. The student is shown how WHILE loops can be used to perform various operations on a list of

24
data values, and how a file of records can be processed and searched for specific records or field values.
Chapter 11: Structured Data—Working with Arrays. This chapter introduces numerically-indexed arrays,
and shows how arrays can be used to store, access, and update multiple-related values. The use of the FOR loop
to process arrays is explained, and various array-processing algorithms are demonstrated.
Chapter 12: Associative Arrays. This chapter introduces associative arrays. Students learn how to use
associative arrays as lookups, and gain a better understanding of the $_POST array and the way that data is
received from HTML forms. Web sessions are introduced, and students learn how to use the $_SESSION array
to maintain session data between applications.
Chapter 13: Program Modularity—Working with Functions. This chapter demonstrates the importance of
program modularity and introduces functions, include files and objects. Students learn to write their own
functions, to build libraries of related functions, and to call functions from different applications as needed.
Chapter 14: Connecting to a Database—Working with MySQL. This chapter introduces databases queries
as an important application tool. The relationship between relational databases and SQL is explained, along with
the purpose and syntax of common queries (SELECT, INSERT, UPDATE and DELETE). Students learn to
write code to open and close database connections, submit queries, handle errors, perform simple joins, and
process results.
Chapter 15: Introduction to Object-Oriented Programming. This chapter introduces Object-Oriented
Programming. Examples show how simple object classes are designed, how class variables are encapsulated and
accessed by class methods, how objects are instantiated and used in applications, and how classes can be inherited
by other classes. An overview of basic OO terminology is provided.
Chapter 16: Where to Go From Here. This last chapter provides a short overview of key concepts and
technologies that the students may want to explore after completing this textbook, along with clarification of
some of the conventions followed in the book.
The textbook also includes a number of useful appendices as follows:
Appendix A introduces data representation, and shows how binary values can store data for a wide range of
purposes.
Appendix B provides an introduction to overview of file and folder management, file addressing schemes
(including relative and absolute addresses), and the use of the command line with a list of common DOS and
Unix command equivalents.
Appendix C provides help for students wishing to use different Web server installations.
Appendix D provides debugging help for students having trouble identifying and resolving PHP code errors.
Appendix E provides additional material and references for students wishing to learn more about HTML and
style sheets.
Appendix F provides additional information regarding PHP data types, and provides a list of common PHP
functions not covered in the book.
Appendix G provides additional coverage of common PHP operators and structures that were omitted from
the chapters to avoid overwhelming the beginning student (for example, shortcut operators, the SWITCH
statement, DO..WHILE loops, and multi-dimensional arrays).

25
Acknowledgments

This textbook could not have been created without the generous help and support of many others. In particular I
want to thank my dear wife Constance Humphries for her invaluable technical advice, proof-reading,
development of video tutorials, and daily encouragement and patience! My sincere thanks to Scott Sipe, Beth
Hall, Sara Hjelt, and all at Carolina Academic Press for their supportive style, professionalism and experience.
Thanks to all my fellow instructors at A-B Tech (Asheville-Buncombe Technical Community College), especially
to Charlie Wallin and Fred Smartt who field-tested the first edition, and provided invaluable suggestions and
corrections. And thanks to all of those students who have learned with me and sometimes in spite of me as this
book evolved in the classroom. A particular thank you to A-B Tech students Uma Benson, Jean-Jacques Maury,
and Kenneth Stanley, who all voluntarily provided me with carefully compiled lists of corrections that were
incorporated into the fourth edition. Their engagement with the material and concern for future students is
greatly appreciated. Any remaining errors or inconsistencies are of course my own.
Lastly, a huge thank you to Kai ‘Oswald’ Seidler, Kay Vogelgesang, and all those who have contributed to the
Apache Friends Project, and who continue to deliver and support the XAMPP distribution. So many of us owe
you our great appreciation for your generosity of spirit!

26
About the Author

Mike O'Kane holds a master's degree in Systems Science (specializing in Advanced Technology) from
Binghamton University. He has over eighteen years' experience teaching computer science courses, most recently
at Asheville-Buncombe Technical Community College in North Carolina. He also has extensive practical
experience in the use of technology for learning, having worked at IBM as a short-course developer, NC State
University as an Instructional Coordinator, and the University of North Carolina system as the first Executive
Director of the UNC Teaching and Learning with Technology Collaborative. He has a passion for developing
effective instructional content, and learning environments that promote rather than hinder student learning.

27
Chapter 1

Introducing Computer Programming

Intended Learning Outcomes


After completing this chapter, you should be able to:

Explain the difference between computers and other machines.


escribe the purpose of the microprocessor's instruction set.
Explain the relationship between the instruction set and machine language.
List some common tasks that computer programs perform.
escribe what programmers do.
Summarize the stages of the software development cycle.
Explain the importance of writing and communications for programmers.
Explain the relationship between high-level programming languages and machine language.
istinguish between the purpose of a compiler and an interpreter.
Explain the difference between standalone and network applications.
Explain the difference between programming languages and markup languages.

28
Introduction
Welcome! If you have never programmed before, this book is for you. By the time you complete the chapters and
exercises, you will have a good grasp of the basic logic and design of computer programs. The book is designed to
teach common programming syntax and control structures in a manner that will prepare you for further study in
this field, and provide you with sufficient expertise to develop small, interactive Web applications, using a
combination of the HTML markup language and PHP programming language. You will also be introduced to
the CSS stylesheet language, and the MariaDB and MySQL database languages.
To get started, in this first chapter we will explore the general process of programming and define some
important term and practices. For a book that is supposed to be hands-on this chapter is mostly descriptive! Don't
be too concerned if some of the topics don't make complete sense yet. Your understanding will deepen as you
work through the chapters and develop your own applications.

29
Exploring the Variety of Random
Documents with Different Content
“Yes, yes, I know, though. M. Auber told me. I am to go into M.
Provost’s class. M. Beauvallet wanted me, but his voice is too loud for
me!”
A disagreeable girl exclaimed: “Can’t you stop that? And so they all
want you!”
A pretty girl, who was too dark, though, for my taste, came nearer
and asked me gently what I had recited.
“The fable of the ‘Two Pigeons,’” I replied.
She was surprised, and so was everyone; while, as for me, I was
wildly delighted to surprise them all. I tossed my hat on my head,
shook my frock out, and dragging my two friends along, ran away
dancing. They wanted to take me to the confectioner’s to have
something, but I refused. We got into a cab, and I should have liked
to push that cab along myself. I fancied I saw the words “I have
passed” written up over all the shops. When, on account of the
crowded streets, the cab had to stand, it seemed to me that the
people stared at me, and I caught myself tossing my head as though
telling them all that it was quite true I had passed my examination. I
never thought any more about the convent, and only experienced a
feeling of pride at having succeeded in my first venturesome
enterprise. Venturesome, but the success had depended only on me.
It seemed to me as though the cabman would never arrive at 265 Rue
St. Honoré. I kept putting my head out of the window and saying:
“Faster, cabby; faster, please!” At last we reached the house, and I
sprang out of the cab and hurried along to tell the good news to my
mother. On the way I was stopped by the daughter of the hall porter.
She was a staymaker, and worked in a little room on the top floor of
the house, the window of which was opposite our dining-room where
I used to do my lessons with my governess, so that I could not help
seeing her ruddy, wide-awake face constantly. I had never spoken to
her, but I knew who she was.
“Well, Mlle. Sarah, are you satisfied?” she called out.
“Oh, yes, I have passed,” I answered, and I could not resist
stopping a minute in order to enjoy the astonishment of the hall-
porter family. I then hurried on, but on reaching the courtyard came
to a dead stand, anger and grief taking possession of me, for there I
beheld my petite dame, her two hands forming a trumpet, her head
thrown back, shouting to my mother who was leaning out of the
window: “Yes, yes, she has passed!” I gave her a thump with my
clenched hand and began to cry with rage, for I had prepared a little
story for my mother, ending up with the joyful surprise. I had
intended putting on a very sad look on arriving at the door, and
pretending to be broken-hearted and ashamed. I felt sure she would
say: “Oh, I am not surprised, my poor child, you are so foolish!” and
then I should have thrown my arms round her neck and said: “It isn’t
true, it isn’t true; I have passed!” I had pictured to myself her face
brightening up, and then old Marguerite and my godfather laughing
heartily, and my sisters dancing with joy, and here was Mme.
Guérard sounding her trumpet and spoiling all my effects that I had
prepared so well.
I must say that the kind woman continued as long as she lived
(that is the greater part of my life) spoiling all my effects. It was all in
vain that I made scenes; she could not help herself. Whenever I told
a good story and wanted it to be very effective, she would invariably
burst into fits of laughter before the end of it. If I started on a story
with a very lamentable ending, which was to be a surprise, she would
sigh, roll her eyes, and murmur: “Oh, dear! oh, dear!” so that I
always missed the effect I was counting on. Still more often, when
anything was being guessed and I asked people for the answer, she
would reply before anyone else, as she was always in my confidence,
and I had perhaps told her the answer a second before. All this used
to exasperate me to such a degree that, before beginning a story or a
game, I used to ask her to go out of the room, and she would get up
and go, laughing at the idea of the blunder she would make if there.
Furious, then, on this occasion, and abusing Mme. Guérard, I went
upstairs to my mother, whom I found at the open door. She kissed
me affectionately, and on seeing my sulky face asked if I was not
satisfied.
“Yes,” I replied, “but I am furious with Guérard. Be nice, mamma,
and pretend you don’t know. Shut the door, and I will ring.”
She did this, and I rang the bell. Marguerite opened the door, and
my mother came and pretended to be astonished. My sisters, too,
arrived, and my godfather and my aunt. When I kissed my mother,
exclaiming, “I have passed!” everyone shouted with joy, and I was
gay again. I had made my effect anyhow. It was “the career” taking
possession of me unawares.
My sister Régina, whom the Sisters would not have in the convent
and so had sent home, began to dance a jig. She had learned this in
the country when she had been put out to nurse, and upon every
occasion she danced it, finishing always with this couplet:
My little dear, rejoice,
Everything is for you....

Nothing could be more comic than this chubby child with her serious
air. Régina never laughed, and only a suspicion of a smile ever played
over her thin lips and over her mouth, which was too small. Nothing
could be more comic than to see her, looking grave and rough,
dancing the jig. She was funnier than ever that day, as she was
excited by the general joy. She was four years old, and nothing ever
embarrassed her. She was both timid and bold. She detested society
and people generally, but if made to go in the dining-room she
embarrassed people by her crude remarks, which were most odd, by
her rough answers and her kicks and blows. She was a terrible child,
with silvery hair, dark complexion, blue eyes too large for her face,
and thick lashes which made a shadow on her cheeks when she
lowered the lids, and joined her eyebrows when her eyes were open.
She would be four or five hours sometimes without uttering a word,
without answering any question she was asked, and then she would
jump up from her little chair, begin to sing as loud as she could, and
dance the jig. On this day she was in a good temper, for she kissed
me affectionately and opened her thin lips to smile. My sister Jeanne
kissed me, and made me tell her about my examination. My
godfather gave me a hundred francs, and M. Meydieu, who had just
arrived to find out the result, promised to take me the next day to
Barbédienne’s to choose a clock for my room, as that was one of my
dreams.
CHAPTER VI
I DECLINE MATRIMONY AND WED ART

The great change began in me from that day. For rather a long time,
indeed, my soul remained childlike, but my mind discerned life more
distinctly. I felt the need of creating a personality for myself. That
was the first awakening of my will. I wanted to be some one. Mlle. De
Brabender declared to me that this was pride. It seemed to me that it
was not quite that, but I could not then define what the sentiment
was which imposed this wish on me. I did not understand until a few
months later why I wished to be some one.
A friend of my godfather’s made me an offer of marriage. This man
was a rich tanner, and very kind, but so dark and with such long hair
and such a beard that he disgusted me. I refused him, and my
godfather then asked to speak to me alone. He made me sit down in
my mother’s boudoir, and said to me:
“My poor child, it is pure folly to refuse M. B——. He has sixty
thousand francs a year and expectations.”
It was the first time I had heard this use of the word, and when the
meaning was explained to me I wondered if that was the right thing
to say on such an occasion.
“Why, yes,” replied my godfather, “you are idiotic with your
romantic ideas. Marriage is a business affair, and must be considered
as such. Your future father and mother-in-law will have to die, just as
we shall, and it is by no means disagreeable to know that they will
leave two million francs to their son, and consequently to you, if you
marry him.”
“I shall not marry him, though.”
“Why?”
“Because I do not love him.”
“But you never love your husband before—” replied my practical
adviser. “You can love him after.”
“After what?”
“Ask your mother. But listen to me now, for it is not a question of
that. You must marry. Your mother has a small income which your
father left her, but this income comes from the profits of the
manufactory which belongs to your grandmother, and she cannot
bear your mother, who will therefore lose that income, and then have
nothing and three children on her hands. It is that accursed lawyer
who is arranging all this. The whys and wherefores would take too
long to explain. Your father managed his business affairs very badly.
You must marry, therefore, if not for your own sake, for the sake of
your mother and sisters. You can then give your mother the hundred
thousand francs your father left you, which no one else can touch. M.
B—— will allow you three hundred thousand francs. I have arranged
everything, so that you can give this to your mother if you like, and
with four hundred thousand francs she will be able to live very well.”
I cried and sobbed, and asked to have time to think it over. I found
my mother in the dining-room.
“Has your godfather told you?” she asked gently, in rather a timid
way.
“Yes, mother; yes, he has told me. Let me think it over, will you?” I
said, sobbing, as I kissed her neck lingeringly.
I then locked myself in my bedroom, and, for the first time for
many days, I regretted the separation from my convent. All my
childhood rose up before me, and I cried more and more, and felt so
unhappy that I wished I could die. Gradually, however, I began to get
calm again and realized what had happened, and what my
godfather’s words meant. Most decidedly I did not want to marry this
man. Since I had been at the Conservatoire, I had learned a few
things vaguely, very vaguely, for I was never alone, but I understood
enough to make me not want to marry without being in love. I was,
however, destined to be attacked in a quarter from which I should
not have expected it. Mme. Guérard asked me to go up to her room
to see the embroidery she was doing on a frame for my mother’s
birthday.
My astonishment was great to find M. B—— there. He begged me
to change my mind. He made me very wretched, for he pleaded with
tears in his eyes.
“Do you want a larger marriage settlement?” he asked. “I would
make it five hundred thousand francs.”
But it was not that at all, and I said in a very low voice:
“I do not love you, monsieur.”
“If you do not marry me, mademoiselle,” he said, “I shall die of
grief.”
I looked at him and repeated to myself the words, “die of grief.” I
was embarrassed and desperate, but at the same time delighted, for
he loved me just as a man does in a play. Phrases that I had read or
heard came to my mind vaguely, and I repeated them without any
real conviction, and then left him without the slightest coquetry.
M. B—— did not die. He is still living, and has a very important
financial position. He is much nicer now than when he was so black,
for at present he is quite white.

I had just passed my first examination with remarkable success,


particularly in tragedy. M. Provost, my professor, had not wanted me
to compete in “Zaïre,” but I had insisted. I thought that scene with
Zaïre and her brother Nivestan very fine, and it suited me. But when
Zaïre, overwhelmed with her brother’s reproaches, falls on her knees
at his feet, Provost wanted me to say the words, “Strike, I tell you! I
love him!” with violence, and I wanted to say them gently, perfectly
resigned to a death that was almost certain. I argued about it for a
long time with my professor, and finally I appeared to give in to him
during the lesson. But on the day of the competition I fell on my
knees before Nerestan with a sob so real, my arms outstretched,
offering my heart so full of love to the deadly blow that I expected,
and I murmured with such tenderness, “Strike, I tell you! I love
him!” that the whole house burst into applause and demanded it
twice over.
The second prize for tragedy was awarded me, to the great
dissatisfaction of the public, as it was thought that I ought to have
had the first prize. And yet it was only just that I should have the
second, on account of my age and the short time I had been studying.
I had a first accessit for comedy in “La Fausse Agnes,” and Sarcey
wrote an article about it.
I felt, therefore, that I had the right to refuse M. B——. My future
lay open before me, and consequently my mother would not be in
want if she should lose her present income. A few days later, M.
Régnier, professor at the Conservatoire and secretary of the Comédie
Française, came to ask my mother whether she would allow me to
play in a piece of his at the Vaudeville. The piece was “Germaine,”
and the managers would give me twenty-five francs for each
performance. I was amazed at the sum! Seven hundred and fifty
francs a month for my first appearance! I was wild with joy. I
besought my mother to accept the offer made by the Vaudeville, and
she told me to do as I liked in the matter.
I asked M. Camille Doucet, director of the Beaux-Arts, to allow me
to recite something to him, and, as my mother always refused to
accompany me, Mme. Guérard went with me. My little sister, Régina,
begged me to take her, and very unwisely I consented. We had not
been in the director’s office more than five minutes before my sister,
who was only six years old, began to climb on the furniture. She
jumped on a stool, and finally sat down on the floor, pulling the
paper basket, which was under the desk, toward her, and proceeded
to spread all the torn papers which it contained about the room. On
seeing this, Camille Doucet mildly observed that she was not a very
good little girl. My sister, with her head in the basket, answered in
her husky voice:
“If you bother me, monsieur, I shall tell everyone that you are
there to give out holy water that is poison—my aunt says so.”
My face turned purple with shame, and I stammered out:
“Please do not believe that, M. Doucet, my little sister is telling an
untruth.”
Régina sprang to her feet and, clenching her fists, rushed at me
like a little fury:
“Aunt Rosine never said that?” she exclaimed. “You are telling the
untruth ... why, she said it to M. De Morny, and he answered....”
I had forgotten this, and I have forgotten what the Duc de Morny
answered, but, beside myself with anger, I put my hand over my
sister’s mouth and took her quickly away. She howled like a wildcat,
and we rushed like a hurricane through the waiting room which was
full of people. I then gave way to one of those violent fits of temper to
which I had been subject in my childhood. I sprang into the first cab
that passed the door, and, when once in the cab, struck my sister
with such fury that Mme. Guérard was alarmed, and protected her
with her own body, receiving all the blows I gave with my head,
arms, and feet, for in my anger, rage, and shame I flung myself about
to right and left. My rage was all the more profound from the fact
that I was very fond of Camille Doucet. He was gentle and charming,
affable and kind-hearted. He had refused my aunt something she had
asked for, and, unaccustomed to being refused anything, she had a
spite against him. This had nothing to do with me, though, and I
wondered what Camille Doucet would think. And then, too, I had not
asked him about the Vaudeville.
All my fine dreams had come to nothing. And it was this little
monster, who looked as fair and as white as a seraph, who had just
shattered my hopes. Huddled up in the cab, an expression of fear on
her self-willed face, and her thin lips compressed, she was gazing at
me under her long lashes with half-closed eyes. On reaching home I
told my mother all that had happened, and she declared that my little
sister should have no dessert for two days. Régina was greedy, but
her pride was greater than her greediness. She turned round on her
little heels and, dancing her jig, began to sing, “My little stomach isn’
at all glad,” until I wanted to rush at her and shake her.
A few days later, during my lessons, I was told that the Ministry
refused to allow me to act at the Vaudeville.
M. Régnier told me how sorry he was, but he added in kindly tone:
“Oh, but, my dear child, the Conservatoire thinks a lot of you!
Therefore you need not worry too much.”
“I am sure that Camille Doucet is at the bottom of it,” I said.
“No, he certainly is not,” answered M. Régnier, “Camille Doucet
was our warmest advocate, but the Ministry will not, upon any
account, hear of anything that might be detrimental to your début
next year.”
I at once felt most grateful to Camille Doucet for his kindness in
bearing no ill-will after my little sister’s stupid behavior. I began to
work again with the greatest zeal, and did not miss a single lesson.
Every morning I went to the Conservatoire with my governess. We
started early, as I preferred walking to taking the omnibus, and I
kept the franc which my mother gave me every morning, part of
which was for the omnibus and part for cakes. We were to walk home
always, but every other day we took a cab with the two francs I had
saved for this purpose. My mother never knew about this little
scheme, but it was not without remorse that my kind Brabender
consented to be my accomplice.
As I said before, I did not miss a lesson, and I even went to the
deportment class, at which poor old M. Elie, duly curled, powdered,
and adorned with lace frills, presided. This was the most amusing
lesson imaginable. Very few of us attended this class, and M. Elie
avenged himself on us for the abstention of the others. At every
lesson each one of us was called forward. He addressed us by the
familiar term of thou, and considered us as his property. There were
only five or six of us, but we each had to mount the stage. He always
stood up with his little black stick in his hand. No one knew why he
should have this stick.
LE CONSERVATOIRE NATIONAL DE MUSIQUE ET DE
DECLAMATION, PARIS.

“Now, young ladies,” he would say, “the body thrown back, the
head up, on tiptoes—that’s it—perfect. One, two, three, march.”
And we marched along on tiptoes with heads up and eyelids drawn
over our eyes as we tried to look down in order to see where we were
walking. We marched along like this with all the stateliness and
solemnity of camels! He then taught us to make our exit with
indifference, dignity, or fury, and it was amusing to see us going
toward the doors either with a lagging step or in an animated or
hurried way, according to the mood in which we were supposed to
be. Then we heard: “Enough! Go! Not a word!” for M. Elie would not
allow us to murmur a single word. “Everything,” he used to say, “is in
the look, the gesture, the attitude!” Then there was what he called
“l’assiette,” which meant the way to sit down in a dignified manner,
to let oneself fall into a seat wearily, or the “assiette,” which meant:
“I am listening, monsieur; say what you wish.” Ah, that was
distractingly complicated, that way of sitting down! We had to put
everything into it: the desire to know what was going to be said to us,
the fear of hearing it, the determination to go away, the will to stay.
Oh, the tears that this “assiette” cost me! Poor old M. Elie! I do not
bear him any ill-will, but I did my utmost later on to forget
everything he had taught me, for nothing could have been more
useless than those deportment lessons. Every human being moves
about according to his or her proportions. Women who are too tall
take long strides, those who stoop walk like the Eastern women;
stout women walk like ducks, short-legged ones trot; very small
women skip along, and the gawky ones walk like cranes. Nothing can
be done for them, and the deportment class has very wisely been
abolished. The gesture must depict the thought, and it is harmonious
or stupid, according to whether the artiste is intelligent or null. For
the theater one needs long arms; it is better to have them too long
than too short. An artiste with short arms can never, never make a
fine gesture. It was all in vain that poor Elie told us this or that. We
were always stupid and awkward, while he was always comic; oh, so
comic, poor old man!
I also took fencing lessons. Aunt Rosine put this idea into my
mother’s head. I had a lesson once a week from the famous Pons. Oh,
what a terrible man he was! Brutal, rude, and always teasing, he was
an incomparable fencing master, but he disliked giving lessons to
“brats” like us, as he called us. He was not rich, though, and I believe,
but am not sure of it, that this class had been organized for him by a
distinguished patron of his. He always kept his hat on, and this
horrified Mlle. De Brabender. He smoked his cigar, too, all the time,
and this made his pupils cough, as they were already out of breath
from the fencing exercise. What torture those lessons were! He
brought with him sometimes friends of his who delighted in our
awkwardness. This gave rise to a scandal, as one day one of these gay
spectators made a most violent remark about one of the pupils
named Châtelain, and the latter turned round quickly and gave him a
blow in the face. A skirmish immediately occurred, and Pons, on
endeavoring to intervene, received a blow or two himself. This made
a great stir, and from that day forth visitors were not allowed to be
present at the lesson. I persuaded my mother to let me discontinue
attending this class, and this was a great relief to me.
I very much preferred Régnier’s lessons to any others. He was
gentle, had nice manners, and taught us to be natural in what we
recited, but I certainly owe all that I know to the variety of
instruction which I had, and which I followed up in the most devoted
way.
Provost taught a broad style, with diction somewhat pompous but
sustained. He especially emphasized freedom of gesture and
inflection. Beauvallet, in my opinion, did not teach anything that was
good. He had a deep, effective voice, but that he could not give to
anyone. It was an admirable instrument, but it did not give him any
talent. He was awkward in his gestures, his arms were too short, and
his face common. I detested him as a professor.
Samson was just the opposite. His voice was not strong, but
piercing. He had a certain acquired distinction, but was very correct.
His method was simplicity. Provost emphasized breadth; Samson
exactitude, and he was very particular about the finals. He would not
allow us to drop the voice at the end of the phrase. Coquelin, who is
one of Régnier’s pupils, I believe, has a great deal of Samson’s style,
although he has retained the essentials of his first master’s teaching.
As for me, I remember my three professors, Régnier, Provost, and
Samson, as though I had heard them only yesterday.
The year passed by without any great change in my life, but two
months before my second examination I had the misfortune to have
to change my professor. Provost was taken ill, and I went in to
Samson’s class. He counted very much on me, but he was
authoritative and persistent. He gave me two very bad parts in two
very bad pieces: Hortense, in “L’Ecole des Vieillards,” by Casimir
Delavigne, for comedy, and “La Fille du Cid,” for tragedy. This piece
was also by Casimir Delavigne. I did not feel at all in my element in
these two rôles, both of which were written in hard, emphatic
language.
The examination day arrived, and I did not look at all nice. My
mother had insisted on my having my hair done up by her
hairdresser, and I had cried and sobbed on seeing this “Figaro” make
partings all over my head in order to separate my rebellious mane.
Idiot that he was, he had suggested this style to my mother, and my
head was in his stupid hands for more than an hour and a half, for he
never before had to deal with a mane like mine. He kept mopping his
forehead every five minutes, and muttering: “What hair! Good
heavens! it is horrible—just like tow! It might be the hair of a white
negress!” Turning to my mother, he suggested that my head should
be entirely shaved, and the hair then trained as it grew again. “I will
think about it,” replied my mother in an absent-minded way. I
turned my head so abruptly to look at her when she said this that the
curling irons burned my forehead. The man was using the irons to
uncurl my hair. He considered that it curled naturally in such a
disordered style that he must get the natural curl out of it and then
wave it, as this would be more becoming to the face.
“Mademoiselle’s hair is stopped in its growth by this extreme
curliness. All the Tangiers girls and negresses have hair like this. As
mademoiselle is going on the stage, she would look better if she had
hair like madame,” he said, bowing with respectful admiration to my
mother, who certainly had the most beautiful hair imaginable. It was
fair and so long that, when standing up, she could tread on it and not
bend her head. It is only fair to say, though, that my mother was very
short.
Finally, I was out of the hands of this wretched man, and was
nearly dead with fright after an hour and a half’s brushing, combing,
curling, hairpinning, with my head turned from left to right and from
right to left. I was completely disfigured at the end of it all, and did
not recognize myself. My hair was drawn tightly back from my
temples, my ears were very visible and stood out, looking positively
improper in their nakedness, while on the top of my head was a
parcel of little sausages arranged near each other to imitate the
ancient diadem.
I was perfectly hideous. My forehead, of which I caught a glimpse
under the golden mass of my hair, seemed to me immense,
implacable. I did not recognize my eyes, accustomed as I was to see
them veiled by the shadow of my hair. My head seemed to weigh two
or three pounds. I was accustomed to do my hair as I still do, with
two hairpins, and this man had put five or six packets in it. All this
was heavy for my poor head.
I was late, and so I had to dress very quickly. I cried with anger,
and my eyes grew smaller, my nose larger, and my veins swelled. But
it was the climax when I had to put my hat on. It would not go on the
pile of sausages, and my mother wrapped my head up in a lace scarf
and hurried me to the door.
On arriving at the Conservatoire, I hurried with my petite dame to
the waiting room, while my mother went direct to the hall. When
once I was in the waiting room I tore off the lace, and, seated on a
bench, after relating the Odyssey of my hairdressing, I gave my head
up to my companions. All of them adored and envied my hair,
because it was so soft and light and golden. All of them took pity on
my sorrow, and were touched by my ugliness. Their mothers,
however, were spluttering in their own fat with joy.
The girls began to take out my hairpins, and one of them, Marie
Lloyd, whom I liked best, took my head in her hands and kissed it
affectionately.
“Oh, your beautiful hair, what have they done to it!” she exclaimed,
pulling out the last of the hairpins. This sympathy made me once
more burst into tears.
Finally, I stood up triumphant, without any hairpins and without
any sausages. But my poor hair was heavy with the beef marrow the
wretched man had put on it, and it was full of the partings he had
made for the creation of the sausages. It fell now in mournful-
looking, greasy flakes around my face. I shook my head for five
minutes in mad rage. I then succeeded in making the hair more
loose, and I put it up as well as I could with a couple of hairpins.
The competition had commenced, and I was the tenth to be called.
I could not remember what I had to say. Mme. Guérard moistened
my temples with cold water, and Mlle. De Brabender, who had only
just arrived, did not recognize me, and was looking about for me
everywhere. She had broken her leg nearly three months ago, and
had to support herself on a crutch, but she had wished to come.
Mme. Guérard was just beginning to tell her about the drama of
the hair when my name echoed through the room. “Mlle. Chara
Bernhardt!” It was Leautaud, who later on was prompter at the
Comédie Française, and who had a strong Auvergne accent. “Mlle.
Chara Bernhardt!” I heard again, and I then sprang up without an
idea in my mind and without uttering a word. I looked round for the
pupil who was to give me my answers, and together we made our
entry.
I was surprised at the sound of my voice, which I did not
recognize. I had cried so much that it had affected my voice, and I
spoke through my nose.
I heard a woman’s voice say:
“Poor child, she ought not to have been allowed to compete; she
has an atrocious cold, her nose is running, and her face is swollen.”
I finished my scene, made my bow, and went away in the midst of
very feeble and spiritless applause. I walked like a somnambulist,
and on reaching Mme. Guérard and Mlle. De Brabender fainted away
in their arms. Some one went to the hall in search of a doctor, and
the rumor that “the little Bernhardt had fainted” reached my mother.
She was sitting far back in a box bored to death.
When I came to myself again, I opened my eyes and saw my
mother’s pretty face, with tears hanging on her long lashes. I laid my
head against hers and cried quietly, but this time the tears were
refreshing, not salt ones that burned my eyelids.
I stood up, shook out my dress, and looked at myself in the
greenish mirror. I was certainly less ugly now, for my face was rested,
my hair was once more soft and light, and altogether there was a
general improvement in my appearance.
The tragedy competition was over, and the prizes had been
awarded. I had no recompense at all, but my last year’s second prize
had been mentioned. I felt confused, but it did not cause me any
disappointment, as I had quite expected things to be like this. Several
persons had protested in my favor. Camille Doucet, who was a
member of the jury, had argued a long time for me to have a first
prize in spite of my bad recitation. He said that my examination
reports ought to be taken into account, and they were excellent; and
then, too, I had the best class reports. Nothing, however, could
overcome the bad effect produced that day by my nasal voice, my
swollen face, and my heavy flakes of hair. After half an hour’s
interval, during which I drank a glass of port wine and ate cakes, the
signal was given for the comedy competition. I was down as the
fourteenth for this, so that I had ample time to recover. My fighting
instinct now began to take possession of me, and a sense of injustice
made me feel rebellious. I had not deserved my prize that day, but it
seemed to me that I ought to have received it nevertheless.
SARAH BERNHARDT IN THE
HANDS OF HER COIFFEUR.

I made up my mind that I would have the first prize for comedy,
and with the exaggeration that I have always put into everything, I
began to get excited, and I said to myself that if I did not have the
first prize I must give up the idea of the stage as a career. My love of
mysticism and weakness for the convent came back to me more
strongly than ever.
“Yes,” I said to myself, “I will go back to the convent, but only if I
do not get the first prize”; and then the most foolish, illogical strike
imaginable was waged in my weak, girl’s brain. I felt a genuine
vocation for the convent when distressed about losing the prize, and
a genuine vocation for the theater when I was hopeful about winning
the prize.
With a very natural partiality I discovered in myself the gift of
absolute self-sacrifice, renunciation, and devotion of every kind—
qualities which would win for me easily the post of Mother Superior
in the Grandchamps Convent. Then with the most indulgent
generosity I attributed to myself all the necessary gifts for the
fulfillment of my other dream, namely, to become the first, the most
celebrated, and the most envied of actresses. I counted on my fingers
all my qualities: gracefulness, charm, distinction, beauty, mystery,
piquancy. Oh, yes, I found I had all these, and when my reason and
my honesty raised any doubt or suggested a “but” to this fabulous
inventory of my qualities, my combative and paradoxical ego at once
found a plain decisive answer which admitted of no further
argument.
It was under these special conditions and in this frame of mind
that I went on to the stage when my turn came. The choice of my rôle
for this competition was a very stupid one. I had to represent a
married woman who was reasonable and given to reasoning, and I
was a mere child, and looked much younger than I was. In spite of
this, I was very brilliant; I argued well, was very gay, and had
immense success. I was transfigured with joy and wildly excited, so
sure I felt of a first prize.
I never doubted for a moment that it would be awarded to me
unanimously. When the competition was over, the committee met to
discuss the awards, and in the meantime I asked for something to
eat. A cutlet was brought from the pastry cook patronized by the
Conservatoire, and I devoured it, to the great joy of Mme. Guérard
and Mlle. De Brabender, for I detested meat, and always refused to
eat it.
The members of the committee at last went to their places in the
state box, and there was silence in the hall. The young men were
called first on to the stage. There was no first prize awarded to them.
Parfouru’s name was called for the second prize for comedy.
Parfouru is known to-day as M. Paul Porel, director of the Vaudeville
Theater, and Réjane’s husband. After this came the turn for the girls.
I was in the doorway, ready to rush up to the stage. The words
“first prize for comedy” were uttered, and I made a step forward,
pushing aside a girl who was a head taller than I was. “First prize for
comedy awarded unanimously to Mlle. Marie Lloyd.” The tall girl I
had pushed aside now went forward, slender and beaming, toward
the stage.
There were a few muttered protests, but her beauty, her
distinction, and her modest charm won the day with everyone, and
Marie Lloyd was cheered. She passed me on her return, and kissed
me affectionately. We were great friends, and I liked her very, much,
but I considered her a nonentity as a pupil. I do not remember
whether she had received any prize the previous year, but certainly
no one expected her to have one now, and I was simply petrified.
“Second prize for comedy: Mlle. Bernhardt.”
I had not heard this, and was pushed forward by my companions.
On reaching the stage I bowed, and all the time I could see hundreds
of Marie Lloyds dancing before me. Some of them were making
grimaces, others were throwing me kisses—some were fanning
themselves and others bowing. They were very tall, all these Marie
Lloyds—too tall for the ceiling, and they walked over the heads of all
the people and came toward me, crushing me, stifling me, so that I
could not breathe. My face, it seems, was whiter than my dress.
On returning to the green room, I sat down without uttering a
word and looked at Marie Lloyd, who was being made much of, and
who was greatly complimented by everyone. She was wearing a pale
blue tarlatan dress, with a bunch of forget-me-nots in the bodice and
another in her black hair. She was very tall, and her delicate, white
shoulders emerged modestly from her dress, which was cut very low,
as for her this did not matter. Her refined face, with its somewhat
proud expression, was charming and very beautiful. Although very
young, she had more womanly charm than all of us. Her large brown
eyes had a certain play in them, her little round mouth gave a smile
which was full of mischief, and the nostrils of her wonderfully cut
nose dilated. The oval of her beautiful face was intercepted by two
little pearly, transparent ears of the most exquisite shape. She had a
long, flexible white neck, and the pose of her head was charming. It
was a beauty prize that the jury had conscientiously awarded to
Marie Lloyd. She had come on the stage gay and fascinating, in her
rôle of Célimène, and in spite of the monotony of her delivery, the
carelessness of her elocution, the impersonality of her acting, she
had carried off all the votes because she was the very personification
of Célimène, that coquette of twenty years of age who was
unconsciously so cruel. She had realized for everyone the ideal
dreamed of by Molière.
All these thoughts shaped themselves later on in my brain, and
this first lesson, which was so painful at the time, was of great service
to me in my career. I never forgot Marie Lloyd’s prize, and every time
that I had to create a rôle, the physical body of the character always
appeared before me dressed, with her hair done, walking, bowing,
sitting down, getting up. But this was only a vision which lasted a
second, for my mind always thought of the soul governing this
personage. When listening to an author reading his work, I tried to
define the intention of his idea, endeavoring to identify myself with
that intention. I have never played an author false with regard to his
idea, and I have always tried to represent the personage according to
history, whenever it is a historical personage, and when it is an
invention, according to the author.
I have sometimes tried to compel the public to return to the truth,
and to destroy the legendary side of certain personages whom
history, thanks to its documents, now represents to us as they were
in reality; but the public never followed me. I soon realized that
legend remains victorious in spite of history, and this is perhaps a
good thing for the mind of the crowd. Jesus, Joan of Arc,
Shakespeare, the Virgin Mary, Mahomet, and Napoleon I have all
entered into legend.
It is impossible now for our brain to picture Jesus and the Virgin
Mary accomplishing humiliating human functions. They lived the life
that we are living. Death chilled their sacred limbs, and it is not
without rebellion and grief that we accept this fact. We start off in
pursuit of them in an ethereal heaven, in the infinite of our dreams.
We cast down all the dross of humanity in order to let them, clothed
in the ideal, be seated on a throne of love. We do not like Joan of Arc
to be the rustic, bold, peasant woman, repulsing violently the old
soldier who wants to joke with her, sitting astride her big steed like a
man, laughing readily at the coarse jokes of the soldiers, submitting
to the lewd promiscuities of the barbarous epoch in which she lived,
and having, on that account, all the more merit in remaining a most
heroic maiden.
We do not care for such useless truths. In the legend she is a fragile
woman guided by a divine soul. Her girl’s arm which holds the heavy
banner is sustained by an invisible angel. In her childish eyes there is
something from another world, and it is from this that all the
warriors get their strength and courage. It is thus that we wish it to
be, and so the legend remains triumphant.
But to return to the Conservatoire. Nearly all the pupils had gone
away, and I remained quiet and embarrassed on my bench. Marie
Lloyd came and sat down by me.
“Are you unhappy?” she asked.
“Yes,” I answered. “I wanted the first prize, and you have it. It is
unjust.”
“I do not know whether it is just or not,” answered Marie Lloyd,
“but I assure you that it is not my fault.”
I could not help laughing at this.
“Shall I come home with you to luncheon?” she asked, and her
beautiful eyes grew moist and beseeching. She was an orphan and
unhappy, and on this day of triumph she felt the need of a family. My
heart began to melt with pity and affection. I threw my arms round
her neck, and we all four went away together—Marie Lloyd, Mme.
Guérard, Mlle. De Brabender, and I. My mother had sent me word
that she had gone on home.
In the cab my “don’t-care” character won the day once more, and
we chatted gayly about one and another of the people we had seen
during the morning. “Oh, how ridiculous such and such a person
was!” “Did you see her mother’s bonnet?” “And old Estebenet, did
you see his white gloves? He must have stolen them from some
policeman!” And hereupon we laughed like idiots, and then began
again. “And that poor Châtelain had had his hair curled!” said Marie
Lloyd. “Did you see his head?”
I did not laugh any more, though, for this reminded me of how my
own hair had been uncurled, and that it was thanks to that I had not
won the first prize for tragedy.
On reaching home we found my mother, my aunt, my godfather,
our old friend Meydieu, Mme. Guérard’s husband, and my sister
Jeanne with her hair all curled. This gave me a pang, for she had
straight hair, and it had been curled to make her prettier, although
she was charming without that, and the curl had been taken out of
my hair, so that I had looked uglier.
My mother spoke to Marie Lloyd with that charming and
distinguished indifference peculiar to her. My godfather made a
great fuss over her, for success was everything to this bourgeois. He
had seen my young friend a hundred times before, and had not been
struck by her beauty, nor yet touched by her poverty, but on this
particular day he assured us that he had for a long time predicted
Marie Lloyd’s triumph. He then came to me, put his two hands on
my shoulders, and held me facing him.
“Well, you were a failure,” he said. “Why persist now in going in
for the theater? You are thin and small, your face is rather nice close
to, but ugly in the distance, and your voice does not carry!”
“Yes, my dear girl,” put in M. Meydieu, “your godfather is right.
You had better marry the flour man who proposed, or that imbecile
of a Spanish tanner who lost his brainless head for the sake of your
pretty eyes. You will never do anything on the stage! You’d better
marry!”
M. Guérard came and shook hands with me. He was a man of
nearly sixty years of age, and Mme. Guérard was under thirty. He
was melancholy, gentle, and shy; he had been awarded the
distinction of the Legion of Honor, and he wore a long, shabby frock
coat, had aristocratic gestures, and was private secretary to M. De la
Tour Desmoulins, a deputy very much in favor. M. Guérard was a
well of science, and I owe a great deal to his kindness.
Jeanne whispered to me:
“Sister’s godfather said when he came in that you looked as ugly as
possible.” Jeanne always spoke of my godfather in this way. I pushed
her away, and we sat down to table. All through the meal my one
wish was to go back to the convent. I did not eat much, and directly
after luncheon was so tired that I had to go to bed.
When once I was alone in my room between the sheets, with tired
limbs, my head heavy and my heart oppressed with keeping back my
sighs, I tried to consider my wretched situation, but sleep, the great
restorer, came to the rescue and I was very soon slumbering
peacefully. When I awoke I could not collect my thoughts at first. I
wondered what time it was, and looked at my watch. It was just ten,
and I had been asleep since three o’clock in the afternoon. I listened
for a few minutes, but everything was silent in the house. On a table
near my bed was a small tray on which was a cup of chocolate and a
cake. A sheet of writing paper was placed upright against the cup. I
trembled as I took it up, for I never received any letters. With great
difficulty, by my night light, I managed to read the following words,
written by Mme. Guérard:
“When you had gone to sleep the Duc de Morny sent word to your mother that
Camille Doucet had just assured him that you were to be engaged for the Comédie
Française. Do not worry any more, therefore, my dear child, but have faith in the
future. Your petite dame.”
I pinched myself to make sure that I was really awake. I got up and
rushed to the window. I looked out, and the sky was black. Yes, it was
black to everyone else, but starry to me. The stars were shining, and I
looked for my own special one, and chose the largest and brightest.
I went back toward my bed and amused myself with jumping on to
it, holding my feet together. Each time I missed I laughed like a
lunatic. I then drank my chocolate, and nearly choked myself
devouring my cake.
Standing up on my bolster, I then made a long speech to the Virgin
Mary at the head of my bed. I adored the Virgin Mary, and I
explained to her my reasons for not being able to take the veil, in
spite of my vocation. I tried to charm and persuade her, and I kissed
her very gently on her foot, which was crushing the serpent. Then in
the obscurity of the room I looked for my mother’s portrait. I could
scarcely see this, but I threw kisses to it. I then took up the letter
again from my petite dame and went to sleep with it in my mind. I do
not remember what my dreams were that memorable night.
The next day everyone was very kind to me. My godfather, who
arrived early, nodded his head in a contented way.
“She must have some fresh air,” he said. “I will pay for a landau.”
The drive seemed to me delicious, for I could dream to my heart’s
content, as my mother disliked talking when in a carriage.
Two days later, our old servant, Marguerite, breathless with
excitement, brought me a letter. On the corner of the envelope there
was a wide stamp around which stood the magic words: “Comédie
Française.” I glanced at my mother and she nodded, as a sign that I
might open the letter, after blaming Marguerite for giving me a letter
before obtaining her permission to do so.
“It is for to-morrow, to-morrow!” I exclaimed. “I am to go there to-
morrow, look—read it!”
My sisters came rushing to me and seized my hands. I danced
round with them singing, “It is to-morrow, it’s to-morrow.” My
youngest sister was eight years old, but I was only six that day. I went
upstairs to the flat on the top floor to tell Mme. Guérard. She was just
soaping her children’s white frocks and pinafores. She took my face
in her hands and kissed me affectionately. Her two hands were
covered with a soapy lather and left a snowy patch on each side of my
head. I rushed downstairs again in that condition, and went noisily
into the drawing-room. My godfather, M. Meydieu, my aunt, and my
mother were just commencing whist. I kissed each of them, leaving a
little lather on their faces, at which I laughed heartily. But I was
allowed to do anything that day, for I had become a personage.
The next day, Tuesday, I was to go to the Théâtre Français at one
o’clock to see M. Thierry, who was then director.
What was I to wear? That was the great question. My mother had
sent for the milliner, who had arrived with various hats. I chose a
white one trimmed with pale blue, a white bavolet and blue strings.
Aunt Rosine had sent one of her dresses for me, for my mother
thought all my frocks were too childish. Oh, that dress! I shall see it
all my life. It was hideous cabbage green with black velvet put on in
Grecian pattern. I looked like a monkey in that dress. But I was
obliged to wear it. Fortunately it was covered by a mantle of black
grosgrain stitched all round with white. It was thought better for me
to be dressed like a grown-up person, and all my clothes were
suitable only for a child. Mlle. De Brabender gave me a pair of white
gloves, and Mme. Guérard a sunshade. My mother gave me a very
pretty turquoise ring.
Dressed up in this way, looking pretty in my white hat,
uncomfortable in my green dress, but comforted by my mantle, I
went with Mme. Guérard to M. Thierry’s. My aunt lent me her
carriage for the occasion, as she thought it would look better to arrive
in a private carriage. Later on I found that this arrival in my own
carriage, with a footman, made a very bad impression. What all the
theater people thought, I never cared to consider, and it seems to me
that my extreme youth must really have preserved me from all
suspicion.
SARAH BERNHARDT WHEN
SHE LEFT THE
CONSERVATORY.

M. Thierry received me very kindly and made a little nonsensical


speech. He then unfolded a paper, which he handed to Mme.
Guérard, asking her to look at it and then to sign it. This paper was
my engagement, and my petite dame explained that she was not my
mother.
“Ah!” said M. Thierry, getting up, “then will you take it with you
and have it signed by mademoiselle’s mother?”
He then took my hand. I felt an instinctive horror at the touch of
his, for it was flabby, and there was no life or sincerity in its grasp. I
quickly took mine away and looked at him. He was plain, with a red
face, and eyes that avoided one’s gaze. As I was going away I met
Coquelin, who, hearing I was there, had waited to see me. He had
made his début a year before with great success.
“Well, it’s settled, then?” he said gayly.
I showed him the engagement and shook hands with him. I went
quickly down the stairs, and just as I was leaving the theater, found
myself in the midst of a group in the doorway.
“Are you satisfied?” asked a gentle voice, which I recognized as M.
Doucet’s.
“Oh, yes, monsieur, thank you so much,” I answered.
“But my dear child, I have nothing to do with it,” he said.
“Your competition was not at all good, but nevertheless we count
on you,” put in M. Régnier, and then turning to Camille Doucet he
asked: “What do you think, your Excellency?”
“I think that this child will be a very great artiste,” he replied.
There was silence for a moment.
“Well, you have got a turnout!” exclaimed Beauvallet rudely. He
was the first tragedian of the Comédie, and the worst-bred man in
France or anywhere else.
“This turnout belongs to mademoiselle’s aunt,” remarked Camille
Doucet, shaking hands with me gently.
“Oh, well, I would much rather it belonged to her than to me,”
answered the tragedian.
I then stepped into the carriage which had caused such a sensation
at the theater, and drove away. On reaching home I took the
engagement to my mother. She signed it without reading it, and I
then fully made up my mind to be some one, quand-même.
A few days after my engagement at the Comédie Française, my
aunt gave a dinner party. Among her guests were the Duc de Morny,
Camille Doucet, the Minister of the Beaux-Arts, M. De Walewski,
Rossini, my mother, Mlle. De Brabender, and I. During the evening a
great many other people came. My mother had dressed me very
elegantly, and it was the first time I had worn a really low dress. Oh,
how uncomfortable I was! Everyone paid me great attention. Rossini
asked me to recite some poetry, and I consented willingly, glad and
proud to be of some little importance. I chose Casimir Delavigne’s
poem “L’âme du Purgatoire.”
“That should be said with music as an accompaniment,” exclaimed
Rossini, when I came to an end. Everyone approved this idea, and
Walewski said:
“Mademoiselle will begin again and you could improvise an
accompaniment, cher maître.”
There was great excitement, and I at once began again. Rossini
improvised the most delightful harmony, which filled me with
emotion. My tears flowed freely without my being conscious of them,
and at the end my mother kissed me, saying: “This is the first time
that you have really moved me.”
As a matter of fact, she adored music, and it was Rossini’s
improvisation that had moved her.
The Comte de Kératry was also present, an elegant young Hussar,
who paid me great compliments, and invited me to go and recite
some poetry at his mother’s house.
My aunt then sang a song which was very much in vogue, and had
great success. She was coquettish and charming and just a trifle
jealous of this insignificant niece who had taken up the attention of
her admirers for a few minutes.
When I returned home I was quite another being. I sat down,
dressed as I was, on my bed and remained for a long time deep in
thought. Hitherto all I had known of life had been through my family
and my work. I had now just had a glimpse of it through society, and
I was struck by the hypocrisy of some of the people, and the conceit
of others. I began to wonder uneasily what I should do, shy and frank
as I was. I thought of my mother. She did not do anything, though.
She was indifferent to everything. I thought of my Aunt Rosine, who,
on the contrary, liked to mix in everything.
I remained there looking down on the ground, my head in a whirl,
and feeling very anxious, and I did not go to bed until I was
thoroughly cold.
CHAPTER VII
I MAKE MY DÉBUT AND EXIT

The next few days passed by without any particular events. I was
working hard at Iphigénie, as M. Thierry had told me I was to make
my début in this rôle.
At the end of August I received a notice requesting me to be at the
rehearsal of Iphigénie. Oh, that first notice, how it made my heart
beat! I could not sleep at night, and daylight did not come quickly
enough for me. I kept getting up to look at the time. It seemed to me
that the clock had stopped. I had dozed, and I fancied it was the same
time as before. Finally, a streak of light coming through the
windowpanes was, I thought, the triumphant sun illuminating my
room. I got up at once, pulled back the curtains, and mumbled my
rôle while dressing.
I thought of rehearsing with Mme. Devoyod, the first actress at the
Comédie Française for tragedy, with Maubant, with ... I trembled as I
thought of all this, for Mme. Devoyod was not supposed to be very
indulgent. I arrived for the rehearsal an hour before the time. The
stage manager, Davenne, smiled and asked me whether I knew my
rôle.
“Oh, yes!” I exclaimed with conviction.
“Come and rehearse it. Would you like to?” and he took me to the
stage.
I went with him through the long corridor of busts which leads
from the foyer of the artistes to the stage. He told me the names of
the celebrities represented by these busts. I stood still a moment
before that of Adrienne Lecouvreur.
“I love that artiste,” I said.
“Do you know her story?” he asked.
“Yes, I have read all that has been written about her.”
“That’s quite right, my child,” said the worthy man. “You ought to
read all that concerns your art. I will lend you some very interesting
books.”
He took me on toward the stage. The mysterious gloom, the
scenery reared up like fortifications, the bareness of the floor, the
endless number of weights, ropes, trees, friezes, harrows overhead,
the yawning house completely dark, the silence, broken by the
creaking of the floor, and the vaultlike chill that one felt—all this
together awed me. It did not seem to me to be part of that brilliant
frame for the living artistes who every night won the applause of the
house by their merriment or their sobs. No, I felt as though I were in
the tomb of dead glories, and the stage seemed to me to be getting
crowded with the illustrious ghosts of those whom the manager had
just mentioned. With my highly strung nerves, my imagination,
which was always evoking something, now saw them advance toward
me, stretching out their hands. These specters wanted to take me
away with them. I put my hands over my eyes and stood still.
“Are you not well?” asked M. Davenne.
“Oh, yes, thank you, it was just a little giddiness.”
His voice had chased away the specters, and I opened my eyes and
paid attention to the worthy man’s advice. Book in hand, he
explained to me where I was to stand, and my changes of place. He
was rather pleased with my way of reciting, and he taught me a few
of the traditions. At the line:
“Euripide à l’autel, conduisez la victime,” he said: “Mlle. Favart
was very effective there....”
The artistes gradually began to arrive, grumbling more or less.
They glanced at me, and then rehearsed their scenes without taking
any further notice of me at all.
I felt inclined to cry, but I was more vexed than anything else. I
heard a few words that sounded to me coarse, used by one or another
of the artistes. I was not accustomed to such language, as at home
everyone was rather scrupulous, and at my aunt’s a trifle affected,
while at the convent it is unnecessary to say I had never heard a word
that was out of place. It is true that I had been through the
Conservatoire, but I had not associated intimately with any of the
pupils, with the exception of Marie Lloyd and Rose Baretta, the elder
sister of Blanche Baretta, who is now an associate of the Comédie
Française.
When the rehearsal was over, it was decided that there should be
another one at the same hour the following day, in the public foyer.
The costume maker came in search of me, as she wanted to try on
my costume. Mlle. De Brabender, who had arrived during the
rehearsal, went up with me to the costume room. She wanted my
arms to be covered, but the costume maker told her gently that this
was impossible for tragedy.
A dress of white woolen material was tried on me. It was very ugly,
and the veil was so stiff that I refused it. A wreath of roses was tried
on, but this, too, was so ugly that I refused to wear it.
“Well, then, mademoiselle,” said the costume maker dryly, “you
will have to get these things and pay for them yourself, as this is the
costume supplied by the Comédie.”
“Very well,” I answered, blushing, “I will get them myself.”
On returning home I told my mother my troubles, and, as she was
always very generous, she promptly bought me a veil of white barège
that fell in beautiful, large, soft folds, and a wreath of hedge roses
which, at night, looked very soft and white. She also ordered me
buskins from the shoemaker employed by the Comédie.
The next thing to think about was the make-up box. For this my
mother had recourse to the mother of Dica Petit, my fellow student
at the Conservatoire. I went with Mme. Dica Petit to M. Massin, a
manufacturer of these make-up boxes. He was the father of Léontine
Massin, another Conservatoire pupil.
We went up to the sixth floor of a house in the Rue Réamur, and
on a plain-looking door read the words: “Massin, Manufacturer of
Make-up Boxes.” I knocked and a little hunchback girl opened the
door. I recognized Léontine’s sister, as she had come several times to
the Conservatoire.
“Oh,” she exclaimed, “what a surprise for us! Titine,” she then
called out, “here is Mlle. Sarah!”
Léontine Massin came running out of the next room. She was a
pretty girl, very gentle and calm in demeanor. She threw her arms
round me, exclaiming:
“How glad I am to see you! And so you are coming out at the
Comédie. I saw it in the paper.”
I blushed up to my ears at the idea of being mentioned in the
paper.
“I am engaged at the Variétés,” she said, and then she talked away
at such a rate that I was bewildered. Mme. Petit did not enter into all
this, and tried in vain to separate us. She had replied by a nod and an
indifferent “Thanks” to Léontine’s inquiries about her daughter’s
health. Finally, when the young girl had finished saying all she had to
say, Mme. Petit remarked:
“You must order your box; we have come here for that, you know.”
“Ah! then you will find my father in his workshop at the end of the
passage, and if you are not very long I shall still be here. I am going
to rehearsal at the Variétés later on.”
Mme. Petit was furious, for she did not like Léontine Massin.
“Don’t wait, mademoiselle,” she said, “it will be impossible for us
to stay afterwards.”
Léontine was annoyed, and, shrugging her shoulders, she turned
her back on my companion. She then put her hat on, kissed me, and
bowing gravely to Mme. Petit, remarked:
“Good-by, Mme. Gros-tas, and I hope I shall never see you again.”
She then ran off, laughing merrily. I heard Mme. Petit mutter a few
disagreeable words in Dutch, but I did not understand the meaning
of them at the time. We then went to the workshop and found old
Massin at his workbench, planing some small planks of white wood.
His hunchback daughter kept coming in and out, humming gayly all
the time. The father was glum and harassed, and had an anxious
look. As soon as we had ordered the box we took our leave. Mme.
Petit went out first and Léontine’s sister then put her hand into mine
and said quietly:
“Father was not very polite, but it is because he is jealous. He
wanted my sister to be at the Théâtre Français.”
I was rather disturbed by this confidence, and I had a vague idea of
the painful drama which was acting so differently on the various
members of this humble home.
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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebooknice.com

You might also like