Results 1 to 2 of 2

Thread: Parse J2ME PHP

  1. #1
    baby_cweetie is offline Member
    Join Date
    Jun 2012
    Rep Power

    Red face 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,,
    Parse J2ME PHP-database.jpg

    then after that i create connection between php and mysql,,
    this is my connection between php and mysql
    Java Code:
    $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']; 
    after i finish create connection then i make a program in j2me then create connection between j2me and php
    this is my connection
    Java Code:
           public String koneksi(String myurl)
          HttpConnection connection = null;
          InputStream inputstream = null;
            connection = (HttpConnection);
            //HTTP Request
            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)
                connection.getHeaderField(0)+ " " + connection.getHeaderFieldKey(0));
               "Header Field Date: " + connection.getHeaderField("date"));
              //String str;
              inputstream = connection.openInputStream();
              int length = (int) connection.getLength();
              if (length != -1)
                byte incomingData[] = new byte[length];
                str = new String(incomingData);
                ByteArrayOutputStream bytestream =
                      new ByteArrayOutputStream();
                int ch;
                while ((ch = != -1)
                str = new String(bytestream.toByteArray());
             // return str;
          catch(IOException error)
           System.out.println("Caught IOException: " + error.toString());
            if (inputstream!= null)
              catch( Exception error)
                 /*log error*/
            if (connection != null)
              catch( Exception error)
                 /*log error*/
          } //finally
            return str;
    and this is my form
    Form Input
    Parse J2ME PHP-1.jpg
    Form Output
    Parse J2ME PHP-2.jpg
    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

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: Parse J2ME PHP

    See the second paragraph of the Forum Rules.

    Closing this thread and it will be removed later.

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Sax Parse xml
    By siddheshwar in forum XML
    Replies: 1
    Last Post: 06-25-2011, 08:12 PM
  2. How to parse this value
    By Ajitha in forum New To Java
    Replies: 2
    Last Post: 06-03-2010, 07:26 AM
  3. using parse
    By mustachMan in forum New To Java
    Replies: 2
    Last Post: 01-15-2010, 01:32 AM
  4. Replies: 0
    Last Post: 04-22-2009, 01:30 PM
  5. SAX Parse
    By bluefloyd8 in forum New To Java
    Replies: 1
    Last Post: 01-25-2008, 03:57 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts