Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User ruleworld's Avatar
    Join Date
    Dec 2010
    Posts
    2
    Hi,

    I have a mysql database and i add string data to it using a web html form. The html form inserts data to the table using php which is here

    PHP Code:
    <?php

    $con 
    mysql_connect("mysql10.000webhost.com","a7456565_zzz","zzz");
    if (!
    $con)
      {
      die(
    'Could not connect: ' mysql_error());
      }

    mysql_select_db("a7456565_db"$con);

    $sql="INSERT INTO GPS (lat,lon)
    VALUES
    ('
    $_POST[lat]','$_POST[lon]')";

    if (!
    mysql_query($sql,$con))
      {
      die(
    'Error: ' mysql_error());
      }
    echo 
    "1 record added";
    mysql_close($con)

    ?>
    how can i add data to it using JAVA ME?
    I add data using a html form which works fine.
    I tried the following but is not working

    Code:
    HttpConnection conn =
    ("http://www.test.it" + "?TextField=Hello&TextField2=Hello2&Submit=Submit");
    conn.close();

  2. #2
    Nokia Developer Champion hartti's Avatar
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,192
    Your PHP code is expecting the data through HTTP POST. If you add the data in the URL like you have done in the Java Example, you are sending the data with HTTP GET. If that's ok for you, then change the "$_POST" strings in your PHP sample to "$_GET"
    If you want to use POST instead, check this code sample
    http://wiki.forum.nokia.com/index.ph...est_in_Java_ME

    Hartti

  3. #3
    Nokia Developer Champion njzk2's Avatar
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814
    also your parameters are named incorrectly. you php script expects lat and lon, not TextField and TextField2

  4. #4
    Registered User ruleworld's Avatar
    Join Date
    Dec 2010
    Posts
    2
    i managed to do it. thanks.

Similar Threads

  1. Русская кодировка J2ME+PHP+MySQL
    By Ed123 in forum Russian Developer Forum - Форум Российских разработчиков
    Replies: 3
    Last Post: 2010-02-12, 16:06
  2. [wml/php/mySQL] Value retrieval problem
    By prem52k in forum Mobile Web Site Development
    Replies: 2
    Last Post: 2004-03-01, 16:44
  3. HTTP POST, sending data, any idea how to fetch in PHP?
    By imarenic in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2003-11-13, 21:05
  4. PHP and MySQL
    By ge_prosound in forum Mobile Web Site Development
    Replies: 2
    Last Post: 2002-08-14, 14:18
  5. WAP with Linux/PHP/MySQL
    By Nokia_Archived in forum Mobile Web Site Development
    Replies: 1
    Last Post: 2002-05-14, 16:48

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved