How to get summary value from java program to php script? –
we get twine Operacinės sitemos from mysql controlling php script. But when we try to send this value again to php book and get other values we am removing null. we cruise problem competence be with php book that gets non-english characters. Am we blank something? Java code: @Override open vacant onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.single_course_layout); Intent in = getIntent(); courseName = in.getStringExtra(“fullname”); firstname = in.getStringExtra(“firstname”); lastname = in.getStringExtra(“lastname”); TextView tag = (TextView)findViewById(R.id.label); label.setText(courseName); String outline = null; TextView summaryContent = (TextView)findViewById(R.id.summary); ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair(“cname”,””+courseName)); InputStream is = null; String outcome = null; try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(“********”); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); }catch(Exception e){ Log.e(“log_tag”, “Error in http tie “+e.toString()); } try{ BufferedReader reader = new BufferedReader(new InputStreamReader(is,”ISO-8859-10″),8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + “\n”); System.out.println(line); } is.close(); result=sb.toString(); }catch(Exception e){ Log.e(“log_tag”, “Error converting outcome “+e.toString()); } try{ JSONArray jArray = new JSONArray(result); for(int ii=0;ii<jArray.length();ii++){ JSONObject json_data = jArray.getJSONObject(ii); outline = json_data.getString(“summary”); } summaryContent.setText(summary); } catch(JSONException e){ Log.e(“log_tag”, “Error parsing information “+e.toString()); } }; PHP script: <?php mysql_connect(“localhost”,”***”,”*****”); mysql_select_db(“*******”); mysql_query(“SET NAMES utf8″); $fullname = mysql_real_escape_string($_REQUEST[‘cname’]); $q=mysql_query(“SELECT mdl_course.summary FROM mdl_course WHERE mdl_course.fullname = ‘$fullname'”); while($e=mysql_fetch_assoc($q)) $output[]=$e; print(json_encode($output)); mysql_close(); ?> Eddited This php formula works fine. we can see a indispensable output. But since a book above doesn’t work? <?php mysql_connect(“localhost”,”*******”,”*********”); mysql_select_db(“************”); $fullname = ‘Operacinės sistemos'; $q=mysql_query(“SELECT mdl_course.summary FROM mdl_course WHERE mdl_course.fullname = ‘$fullname'”); while($e=mysql_fetch_assoc($q)) $output[]=$e; print(json_encode($output)); mysql_close(); ?>
How to send utf-8_lithuanian_ci to php script? That’s unequivocally simple. utf-8_lithuanian_ci is a collation, so a impulse we have information with an method of that collation, it’s already finished – we wholly need to pass that data. Collation can wholly be receptive when sorting, so as a information is already sorted when we pass it, there is zero else we need to do. If we ask about a encoding, it can not be quite said. It’s common we use a UTF-8 encoding here (as a comparison is UTF-8 based), however, technically we can use any opposite character-encoding as good and as we have not specified that one, it stays imprecise. Additionally, a use of SET NAMES utf8 within PHP is not permitted and a use of a whole mysql progression is discouraged.
java php mysql encoding
Related |
How to be a Programmer: A Short, Comprehensive, and Personal Summary
Debugging is a cornerstone of being a programmer. The initial definition of a noun to debug is to mislay errors, though a definition that unequivocally matters is to see into a …
|
How To Pass PHP Variable From One Page To Another Page | POST |GET …
Pass Variables from One Page to Another — PHP. Tutorial Outline : Passing PHP variables with $_POST; Passing PHP variables in links with $_GET; Passing PHP …
|
How to Send SMS using Java Program (full code sample …
You can use this giveaway Java illustration program to send SMS from your PC controlling GSM modem connected to your mechanism to your COM port. You also need to download …
|
How to Write Doc Comments for the Javadoc Tool
How to Write Doc Comments for a Javadoc Tool. Javadoc Home Page. This request describes a impression guide, add-on and settlement conventions we use in …
|
How to check if String() value is numeric (Beginning Java …
Hello, we have a conditions where we wish to countenance presumably a value upheld in as a String() is a numeric v. alpha/special bake value. The process
|
How to use ArrayList in Java – Java samples – Programming …
The ArrayList category extends AbstractList and implements a List interface. ArrayList supports enterprising arrays that can grow as needed. In Java, customary arrays are of a …
|
How to invoke Java web service in ASP.net using C# – …
In my project, we am in assign of origination a XNA diversion controlling visible studio. However, we wish to use some variables from another Java program to control a game.
|
url – How can I get query string values in JavaScript? – Stack …
Is there a plugin-less proceed of retrieving query twine valuesaround jQuery (or without)? If so, how? If not, is there a plugin that can do so?
|
C++ Programming HOW-TO – Internet FAQ Archives – Online …
1. Introduction (The latest chronicle of this request is during http://www.milkywaygalaxy.freeservers.com. You competence wish to check there for …
|
No comments:
Post a Comment