spyshow 0 Report post Posted September 19, 2004 So it seems as though the php docs make it very clear that mysql and mysqli functions will all connect to the database as a latin1 client. Although i have my server set up with utf8 databases, tables and fields and the default client connection is utf8, php still connects as latin1. My xhtml forms and pages are all utf-8, so when i post utf8 data and insert it into the database the connection assumes that incoming data is latin1 and the data that gets placed in the database is invalid. phpMyAdmin seems to be able to view, add, edit, and retrieve utf8 strings in the database just fine using my current installation of php. How? Does anyone know how to make sure that the complete workflow is entirely utf-8? Share this post Link to post Share on other sites
hbs_25 0 Report post Posted January 10, 2006 Try to use this function mysqli_real_escape_string. Seems to work with PHP 5 and maybe could correct the problem. For more info, check this linkhttp://forums.xisto.com/no_longer_exists/ Share this post Link to post Share on other sites
TavoxPeru 0 Report post Posted April 10, 2006 hi, thats a common problem with no english data, and for that reason a time ago i create this function no manage that problem: function SafeEscapeData($strData){ if (get_magic_quotes_gpc()) { return $strData; } else { return mysql_real_escape_string($strData); }} for php5 use this function mysqli_real_escape_string.hope it will help you.best regards, Share this post Link to post Share on other sites
Ben Devos 0 Report post Posted May 30, 2006 Here is an example: <?php$mysqli = new mysqli("localhost", "my_user", "my_password", "world");/* check connection */if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit();}$mysqli->query("CREATE TEMPORARY TABLE myCity LIKE City");$city = "'s Hertogenbosch";/* this query will fail, cause we didn't escape $city */if (!$mysqli->query("INSERT into myCity (Name) VALUES ('$city')")) { printf("Error: %s\n", $mysqli->sqlstate);}$city = $mysqli->real_escape_string($city);/* this query with escaped $city will work */if ($mysqli->query("INSERT into myCity (Name) VALUES ('$city')")) { printf("%d Row inserted.\n", $mysqli->affected_rows);}$mysqli->close();?> GreetsWtfox Share this post Link to post Share on other sites
Quatrux 4 Report post Posted May 30, 2006 I don't know if this will help, but don't you have to do a mysql query to set utf-8 ? with SET names utf8 ? so you need in your php script to write a query before anything you post/get from the database..mysql_query("SET names utf8");I never done it before, but this is what I know theoretically, hope it helps or maybe I didn't get your problem. Share this post Link to post Share on other sites
HeLLRaiSer 0 Report post Posted June 25, 2006 hello there.. does anyone know PHP? or any learning tutorial?i want to learn PHP?i want to know how to design webpages on PHP?please help me out Share this post Link to post Share on other sites
Houdini 0 Report post Posted June 25, 2006 Well a good FREE online resource for those that are beginning to learn PHP is called Practical PHP Programming. It is up to date and includes PHP 5. I use it when I am indoubt about certain PHP features. I would suggest though that if you want to learn PHP and MySQL you will need a operatin server on your machine. XAMPP or WAMP or if you have a Mac then MAMP all will create and install a webserver with PHP and MySQL and with XAMPP you get Perl and also the ability to switch between PHP 5 and PHP 4. Share this post Link to post Share on other sites
HeLLRaiSer 0 Report post Posted June 25, 2006 Well a good FREE online resource for those that are beginning to learn PHP is called Practical PHP Programming. It is up to date and includes PHP 5. I use it when I am indoubt about certain PHP features. I would suggest though that if you want to learn PHP and MySQL you will need a operatin server on your machine. XAMPP or WAMP or if you have a Mac then MAMP all will create and install a webserver with PHP and MySQL and with XAMPP you get Perl and also the ability to switch between PHP 5 and PHP 4. I have Visited that website its pretty good and very informativethanks alot Share this post Link to post Share on other sites
TavoxPeru 0 Report post Posted June 25, 2006 hello there.. does anyone know PHP? or any learning tutorial? i want to learn PHP? i want to know how to design webpages on PHP? please help me out Hi, you have a lot of good websites to learn php. I recomend you to first download php from the oficial website: PHP Download Page, then read the simple tutorial here: PHP: A simple tutorial and finally i suggest to download the official php help file: PHP Documentation. BTW, dont forget to visit frecuently this forum you will find a lot of good examples and many people that can help you . Best regards, Share this post Link to post Share on other sites
vujsa 0 Report post Posted June 26, 2006 hello there.. does anyone know PHP? or any learning tutorial? i want to learn PHP? i want to know how to design webpages on PHP? please help me out Well, you happen to be in just the right place. We have a lot of people here that know PHP pretty well. There are a lot of tutorials on the subject of PHP in the tutorials section. The PHP section can be found here: http://forums.xisto.com/forum/86-forum/ I personally have written a few of the tutorials in that section and I think of those the easiest to learn from is this one: http://forums.xisto.com/topic/82060-topic/?findpost=1064290206 It seems to be the most relevent to your request since it deals directly with HTML code generation. The next one that might interest you is the one I wrote about basic template websites using PHP. http://forums.xisto.com/topic/86340-topic/?findpost=1064320566 This wil give you a basic idea of how to maintain a website using the PHP include() funtion which will allow you to store various elements of your website in various folders that can be use for every page or only one page depending on the files contents. Basically, you can use this to modify a single file instead of every webpage you have if you want tomake the same change on all of your website. These are the two most basic yet practical tutorials that I know of. They should give you a decent place to start learning from. I could teach you the "Hello World!" script but it isn't very practical. I think you should consider getting a decent beginners book on the subject. I wouldn't worry too much about getting a PHP5 book since there isn't really that big of a difference for a new user and you'll need to learn PHP4 for current compatibility. PHP4 scripts will work on a PHP5 server but there are additions to PHP5 that make PHP4 servers unable to run all PHP5 scripts. You can get a decent used book on the subject for less than $10.00US. My first PHP book was "PHP Fast&Easy Web Developement" by Julie C. Meloni ISBN:1-931841-87-X It was a very good beginner book that explained the use of basic PHP and how to use PHP with MySQL. Additionally, it showed how to set up a Apache based PHP and MySQL web server for home testing. The same author has a new verion of the book out entitled "PHP 5 Fast&Easy Web Developement". I would suggest that you only visit the PHP website after you get a basic understanding of PHP. The PHP website is not a how to website but instead offers a reference of functions and syntax that can be used for PHP scripts. Without some idea of what the various functions do or how to use the syntax in it's most basic form, the PHP manual will only server to confuse and frustrate you. Most PHP scripters use the manual as a quick reference when they forget the proper use of a function or what options a function has built into it. Finally, come up with a task that you want to complete with PHP and attempt to write the code required to perform that task. When you reach a point at which you don't know how to continue, post the code and you problem here. Someone will help you through the rest of the code as you need. If you don't understand the response or you are unclear as to what you should do with the repose, be sure to reply and ask for clarification. Many times the person offering help doesn't know your level of knowledge in PHP and may assume that you know some important piece of information needed to make the solution work. Outside of that, just keep working at it. Do a little script here and another one there. Maybe combine a couple of scripts until you get enough pieces of code together to have an application of some type. Ususally, the easiest way is to write a large script is to write several smal scripts that work together. Hope This Helps! vujsa Share this post Link to post Share on other sites