Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'myqli_connect.php'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. Hi Larry, I am running Xampp v3.1.0.3.1.0 in Windows 7 Mozilla/5.0(compatable; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0. Apache/2.4.3 (Win32) OpenSSL/1.0.1cPHP/5.4.7. My username for MySQL is 'root' and my password is ''. That is how my instructor helped us configure our MySQL (I assume that prevented us from creating a password we would forget)last spring and I haven't changed it. We had a terrible textbook(not yours), and our PHP class was not optimal. I have since graduated, but want to become proficient enough in PHP and other languages to eventually make a living using them. I have been frustrated by the quirks of xampp and related issues, but need to master this before I can justify purchasing a server, etc. and doing it right. When I run this script on page 269, "PHP and MySQL for Dynamic Web Sites, 4th edition", I get this error message. http://localhost/mysqli_connect.php <?php # Script 9.2 - mysqli_connect.php // This file contains the database access information. // this file also establishes a connection to MySQL, // selects the database, and sets the encoding. // Set the database access information as constants: DEFINE ('DB_USER', 'root'); DEFINE ('DB_PASSWORD', ''); DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_NAME', 'sitename'); // Make the connection: $dbc = @mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not connect to MySQL: ' . mysqli_connect_error() ); // Set the encoding ... mysql_set_charset($dbc, 'utf8'); Message: Warning: mysql_set_charset() expects parameter 1 to be string, object given in C:\xampp\htdocs\mysqli_connect.php on line 18 I have inserted and removed single and double quotes throughout the script. I have placed the script in the htdocs file, where it runs, and outside the htdocs file, where it is not found through localhost. If I comment out the ... /* // Set the encoding ... mysql_set_charset($dbc, 'utf8'); */ I get a blank page, as it should appear, I believe. I have hundreds of questions, but will limit them to these. If I leave this in my htdocs and comment out the 'mysqli_set_charset' as above, will I be able to complete the text book and have working scripts? I understand that in real life, with a live server, this is not optimal. Hopefully, once I master PHP enough to make an e-commerce site run and have a server with Apache on it, not xampp, I will be able to configure my files correctly and in a safe manner. I believe there are only a few instances of the charset being different than utf-8 in our files for this textbook. Can I run the script as is and maybe remove the comments when I get a flukey answer? Do I need to upgrade to the latest versions of PHP and MySQL and start from scratch? MikeFromRehobothBeach.
×
×
  • Create New...