Help .. I am very new to php

Links for php scripts

Moderators: egami, macek, gesf

Post Reply
pk0486
New php-forum User
New php-forum User
Posts: 1
Joined: Sun Aug 13, 2017 5:49 am

Sun Aug 13, 2017 6:01 am

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: Select all

<?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: Select all

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

User avatar
hyper
php-forum Fan User
php-forum Fan User
Posts: 728
Joined: Mon Feb 22, 2016 5:52 pm

Sun Aug 13, 2017 10:22 am

What is 'going wrong'?

User avatar
akiraff
New php-forum User
New php-forum User
Posts: 2
Joined: Sun Aug 20, 2017 1:17 pm

Sun Aug 20, 2017 1:23 pm

Could you tell us if your getting any error messages? So that way would be easier to help you.

Post Reply