Parsing UTF-8 encoded content correctly from SQL through Php with Json
To get this thing working, just follow these steps:
1. First thing to do is changing the default character set of your SQL database and its tables to UTF-8.
2. Your Php file should look something like this:
- $connection = mysql_connect("server_ip_address", "user", "password");
- if (!$connection) die("Couldn't connect to server");
- mysql_select_db("database_name", $connection) or die("Could'nt select the database!");
- // This is very IMPORTANT!!!
- mysql_query("SET NAMES 'UTF8'");
- $sth = mysql_query($query);
- $rows = array();
- while($r = mysql_fetch_assoc($sth)) {
- $rows[] = $r;
- }
- print json_encode($rows);
- mysql_close($connection);
- }
3. Now you can parse these json forrmatted strings, to your application. Here's how:
http://www.helloandroid.com/tu
New tutorials from Helloandroid
Recent Apps
Android on Twitter
-
@Idevicegazette (iDevice Gazette)
GSM-to-Skype bridge lets you lose those roaming fees http://bit.ly/lbRJeh #android
11 years 45 weeks ago -
@tommy_banane (tom b.)
RT @AndroidFavorite: #Android New Desktop Android Market Is Live, Adds Several New Features http://zorr0.nl/lFwXNz
11 years 45 weeks ago -
@dwilliams5 (Dennis Williams)
just completed a runtastic run of 3.02 km in 40 min 11 s with #runtastic #Android App: http://tinyurl.com/5tvrpe3
11 years 45 weeks ago -
@S_Pinz (Spinz!)
RT @Androidheadline: Out of box #LG Optimus 3D got Quadrant 2420 score. Thanks @blink_c #io2011 #android http://twitpic.com/4whkdz
11 years 45 weeks ago -
@tayaitapps (Taya IT)
Next Google TV Looks A Lot Like Android http://t.co/dvlTim3 via @alleyinsider #google #apple #android #tv #honeycomb
11 years 45 weeks ago
Poll
Useful resources
Android Development Projects
- iOS/Android Developer to take older Games and bring them Current
- Android apps developer - need to finish urgent.
- Buliding MobileApp For onlie order
- looking for android APP developers
- Create an ecommerce app
- text-to voice for smartphones IOS - GOOGLE - HARMONY - AND ALEXA
- Optimize Images on App
- Create small feature with drag-drop text for Android
- Scouting for advanced website and Mobile apps developers. Potential Long-term contract.
- BLACK SCREEN