Help .. I am very new to php

  • Thread starter Thread starter Anonymous
  • Start date Start date
A

Anonymous

Guest
I have a problem which I can''t seem to solve.

I am trying to submit data from my android app to the server (localhost). Below is the script I have written.

Code:
<?php

require "init.php";
$phone = $_POST("patient_phone");
$email = $_POST("patient_email");
$password = $_POST("patient_password");

$sql = "insert into patient values('".$phone."','".$email."','".$password."');"; 

if (mysqli_query($con,$sql))
{
	echo "Data has been inserted";
}
else
{
	echo "Data insertion failed";
}	

mysqli_close($con);
?>

Code:
<?php

$host = "localhost";
$db_user = "******";
$db_password = "*******";
$db_name = "projectdoctor";

$con = mysqli_connect($host,$db_user,$db_password,$db_name);

?>

My database is projectdoctor and the table is patient. The columns of table are phone, email and password.

And the keys I am passing from my android app are patient_phone, patient_email and patient_password. Of course, the keys are being passed with the corresponding value pair.

Where am I going wrong?
 
Could you tell us if your getting any error messages? So that way would be easier to help you.
 
Back
Top