Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 25th, 2018, 10:21 PM
Friend of Wrox
Points: 1,107, Level: 13
Points: 1,107, Level: 13 Points: 1,107, Level: 13 Points: 1,107, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jul 2004
Location: , , .
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default how to define charset UTF-8

I've seen many ways of defining and might have created a mix of defining things on php. Can you help me edit thingws together:

PHP Code:
// for display
//header("Content-Type: text/html; charset=utf-8");
//header("Content-Type: text/html; charset=utf-8_general_ci");
//define("DSN", "mysql:host=localhost;dbname=biblewheel;charset=utf-8");



/*$pdo = new PDO('mysql:host=hostname;dbname=database', 'username', 'password',

$options = array(PDO::ATTR_PERSISTENT =>true);

$conn = new PDO(DSNUSERNAMEPASSWORD$options);
//array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf-8_general_ci COLLATE utf8"); utf8mb4_bin
    //$conn = new PDO("mysql:host=localhost; dbname=biblewheel;charset=UTF8","root","",array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"))or die("no connection"); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//echo "connection successful<br /><br />\n";
}catch (PDOException $ex){
"A database error occurred ".$ex->getMessage();    
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with the charset when I get data from my db. Varg_88 Classic ASP Databases 0 January 8th, 2014 03:01 PM
page.response.charset manoj.aggarwal ASP.NET 2.0 Professional 0 August 1st, 2007 03:55 AM
charset question Edward King Pro JSP 1 August 8th, 2005 03:09 PM
change charset vincentc Classic ASP Basics 1 May 31st, 2005 04:00 AM
charset encoding bservi XML 0 May 3rd, 2004 07:32 PM

All times are GMT -4. The time now is 04:07 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.