Greetings🙂
My basic aim is to connect my MySQL database to my MobileApplication(emulator). For this I am making use of Tomcat as well. Now I want to write a PHP GET script, as I want to open an HTTP Connection to pass it in the following statement: private final static String URL = (url);
At the moment, my url is: "jdbc:mysql://:3306/db_audiology?", which cannot be passed in HTTP Connection. Please correct me if I'm wrong but I think I need a PHP GET script, which connects to MySQL database using JDBC and then gives the needed data to mobile client.
problem #1)--Firsly, in regard to PHP, I do have it installed and I even used PHP for a course in my 3rd year of college a year back, but now phpinfo() for some reason is not working!🙁 Could somebody please help me out here? Is there a specific directory I need to save this phpinfo.php file?
problem #2)--Once that works out, this is what I've done so far in regard to php:
<html>
<head>
<title> Connection.php </title>
</head>
<body>
<?php
$flag=false;
if($GET['baby_MR']=="") {baddata("baby_MR not provided");}
//if($GET['qty']=="") {baddata("qty not provided");}
else {
$conn=mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("db_audiology",$conn) or die(mysql_error()) ;
$query1="insert into product values (".$GET['pid'].",". $GET['qty']." ) ";
$result=mysql_query($query1,$conn) or die(mysql_error());
}//else
function baddata($msg)
{
if($msg=="baby_MR not provided") {print "baby_MR not entered.<br>";}
//if($msg=="qty not provided") {print "Quantity not entered.<br>";}
}//function
?>
</body>
</html>
----------------------------------------------------------------------------and:
<html>
<head>
<title> Connection </title>
</head>
<body>
<form method="get" action="/Connection.php">
Baby MR : <input type="number" name="baby_MR" value=""><br>
//Price : <input type="text" name="qty" value=""><br>
<input type="submit" name="Add">
</form>
</body>
</html>
<?php
} //if
?>
Please guide me as to what I should do..I will really appreciate any help
Thanking you in anticipation
=)