Wimmerke Posted January 10, 2011 Share Posted January 10, 2011 In attachment is the code I generated from Flex Builder: My issue is that the UTF8 (coding of the MySQL database) isn't correctly interpreted, the solution is to use : $stmt = mysqli_prepare($this->connection, "SET NAMES UTF8;"); But I don't know how to enter it in this syntax? It is I think the: $stmt = mysqli_prepare($this->connection, "SELECT * from $this->tablename"); that has to be modified, but how? Really searching a long time on the correct syntax, but without any result... Please help, thanks a lot Wimmerke [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/223974-flash-builder-php-mysql-utf8-encoding/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 10, 2011 Share Posted January 10, 2011 SET NAMES UTF8 is an actual mysql query that you need to execute separately from your other queries (you can also use mysqli_set_charset().) Since the complete query is under your control, there's no point in using prepared statements to execute it. You can use mysqli_query(). It would actually be best to do this right after you make the connection to the database server. Quote Link to comment https://forums.phpfreaks.com/topic/223974-flash-builder-php-mysql-utf8-encoding/#findComment-1157446 Share on other sites More sharing options...
Wimmerke Posted January 10, 2011 Author Share Posted January 10, 2011 Hello PFMaBiSmAd, could you please quote how I must implement it ? I think the prepare consists of the connection and the query... So putting the "set names" in between, how do I have to split this up? greets Wimmerke Quote Link to comment https://forums.phpfreaks.com/topic/223974-flash-builder-php-mysql-utf8-encoding/#findComment-1157453 Share on other sites More sharing options...
csabber Posted December 2, 2011 Share Posted December 2, 2011 @Wimmerke: this is how I solved it: public function getAllOznamy() { $stmt2 = mysqli_prepare($this->connection, "SET NAMES 'utf8'"); $stmt3 = mysqli_prepare($this->connection, "SET CHARACTER SET 'utf8'"); $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename"); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt2); mysqli_stmt_execute($stmt3); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); Quote Link to comment https://forums.phpfreaks.com/topic/223974-flash-builder-php-mysql-utf8-encoding/#findComment-1293557 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.