×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    26

    Problem with sending variables to a php-script

    Hi,

    i´m writing a midlet, that sends highscore-data from the phone to a my-SQL Server.
    For example, ive written a php-script which inserts a record into the SQL-database if i type (in my Browser):

    http://localhost/Quizphone/write_highscore.php?Points=1456&Name=Foo&Email=mail@foo.com

    that works fine from the browser, all the variables are added correctly. Now i´ve tried this code in my midlet:
    Code:
    HttpConnection conn=null;
    String Url="http://localhost/Quizphone/write_highscore.php?Points=1456&Name=Foo&Email=mail@foo.com"
    System.out.println(Url);
          try{
          conn = (HttpConnection)Connector.open(Url);
          }
          catch (IOException e) 
          {
           System.err.println("The internet-connection could not be established.")
           }
    But nothing happens (no compiler errors, but even no Insert in the database). What is wrong? Please help!

    thanks
    elwoodini

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    17
    You test on mobile phone or nokia emulator?

    Regard,
    Abdun

  3. #3
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    The call to connector.open doesn't actually start the connection. Your connection is in the "setup" stage, where you can set request headers and what not.
    You need to invoke one of the methods that put the connection into the "connected" stage, like conn.getResponseCode(), and only then will the actual connection be made.

    shmoove

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    26

    Many many thanks!!

    Many, many thanks to shmoove!!! Now it works phantastic!!

    peace
    elwoodini

Posting Permissions

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