Connecting to MySQL with PHP
To successfully use the PHP functions to talk to MySQL, you must have MySQL running at a location to which your Web server can connect (not necessarily the same machine as your Web server). You also must have created a user (with a password), and you must know the name of the database to which you want to connect. If you followed the instructions in Chapter 1, “Installing and Configuring MySQL,” and Chapter 3, “Installing and Configuring PHP,” you should already have taken care of this.
In all sample scripts in this chapter, the sample database name is testDB, the sample user is joeuser, and the sample password is somepass. Substitute your own information when you use these scripts.
You can find the section of the ... |
Get Sams Teach Yourself PHP, MySQL® and Apache All in One now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.