Results 1 to 2 of 2
Thread: Parse J2ME PHP
- 06-20-2012, 01:49 PM #1
Member
- Join Date
- Jun 2012
- Posts
- 2
- Rep Power
- 0
Parse J2ME PHP
Hello all,
today i've homework from my lecturer about parse J2ME
i'm using j2me and php
and that my j2me integrated with php,,
i mean like this,,
first, i create database in mysql,,

then after that i create connection between php and mysql,,
this is my connection between php and mysql
after i finish create connection then i make a program in j2me then create connection between j2me and phpJava Code:<?php $link_id = mysql_connect("localhost", "root", ""); if(!mysql_select_db("mobile", $link_id)) die ("error"); $ID = $_GET['ID']; $result = mysql_query("Select * FROM student where ID = '$ID'", $link_id); $baris = mysql_fetch_array($result); echo $baris['name']; ?>
this is my connection
and this is my formJava Code:public String koneksi(String myurl) { HttpConnection connection = null; InputStream inputstream = null; try { connection = (HttpConnection) Connector.open(myurl); //HTTP Request connection.setRequestMethod(HttpConnection.GET); connection.setRequestProperty("Content-Type","//text plain"); connection.setRequestProperty("Connection", "close"); // HTTP Response System.out.println("Status Line Code: " + connection.getResponseCode()); System.out.println("Status Line Message: " + connection.getResponseMessage()); if (connection.getResponseCode() == HttpConnection.HTTP_OK) { System.out.println( connection.getHeaderField(0)+ " " + connection.getHeaderFieldKey(0)); System.out.println( "Header Field Date: " + connection.getHeaderField("date")); //String str; inputstream = connection.openInputStream(); int length = (int) connection.getLength(); if (length != -1) { byte incomingData[] = new byte[length]; inputstream.read(incomingData); str = new String(incomingData); } else { ByteArrayOutputStream bytestream = new ByteArrayOutputStream(); int ch; while ((ch = inputstream.read()) != -1) { bytestream.write(ch); } str = new String(bytestream.toByteArray()); bytestream.close(); } //System.out.println(str); // return str; } } catch(IOException error) { System.out.println("Caught IOException: " + error.toString()); } finally { if (inputstream!= null) { try { inputstream.close(); } catch( Exception error) { /*log error*/ } } if (connection != null) { try { connection.close(); } catch( Exception error) { /*log error*/ } } } //finally return str; }
Form Input

Form Output

When i enter ID then the result will show in textfield(form output) which the result is from record in mysql database
My lecturer told about parse J2ME
That parsing will find unique character like "#"
So my record from mysql databse will be like "ID#Name#Class"
and after that j2me will separate that record like
textfield1 is ID
textfield2 is Name
textfield3 is Class
please help me
- 06-20-2012, 07:12 PM #2
Re: Parse J2ME PHP
See the second paragraph of the Forum Rules.
Closing this thread and it will be removed later.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Sax Parse xml
By siddheshwar in forum XMLReplies: 1Last Post: 06-25-2011, 08:12 PM -
How to parse this value
By Ajitha in forum New To JavaReplies: 2Last Post: 06-03-2010, 07:26 AM -
using parse
By mustachMan in forum New To JavaReplies: 2Last Post: 01-15-2010, 01:32 AM -
Sending J2ME application by blue tooth (by J2ME application). Very URGENT!!!
By maruffaiz in forum CLDC and MIDPReplies: 0Last Post: 04-22-2009, 01:30 PM -
SAX Parse
By bluefloyd8 in forum New To JavaReplies: 1Last Post: 01-25-2008, 03:57 PM


LinkBack URL
About LinkBacks

Bookmarks