This discussion is archived
1 Reply Latest reply: Jan 2, 2011 11:52 PM by 799151 RSS

submit data on mysql using php or html

815170 Newbie
Currently Being Moderated
Hi,

I have a mysql database and i insert data in the table using html form which uses a php script.
How can i insert data into the table from java me?
my php file looks like this

<?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)

?>

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points