I got a question:
I got a webservice (table) indeed I can add remove and edit some records with php.
Behind each button there is a PHP file, like edit.php, delete.php and so one.
If I want to edit a record I get the following message displayed on my browser:
ERR_CONNECTION_REFUSED - localhost refused the connection
EDIT.php:
<?php
ob_start();
include'connect.php';
?>
<?php
if(isset($_POST['submit']))
{
$con=mysqli_connect("localhost","user","pw","db");
$first=mysqli_real_escape_string($con, $_POST['first']);
$last=mysqli_real_escape_string($con, $_POST['last']);
$phone=mysqli_real_escape_string($con, $_POST['phone']);
$age=mysqli_real_escape_string($con, $_POST['age']);
$gender=mysqli_real_escape_string($con, $_POST['gender']);
$blood=mysqli_real_escape_string($con, $_POST['blood']);
$occupation=mysqli_real_escape_string($con, $_POST['occupation']);
$qualification=mysqli_real_escape_string($con, $_POST['qualification']);
$address=mysqli_real_escape_string($con, $_POST['address']);
$city=mysqli_real_escape_string($con, $_POST['city']);
if(!empty($_FILES['image']))
{
$ext = pathinfo($_FILES['image']['name'],PATHINFO_EXTENSION);
$image = time().'.'.$ext;
move_uploaded_file($_FILES["image"]["tmp_name"], 'images/'.$image);
//echo $image;
}
else
{
echo "Image Is Empty";
}
$query1=mysqli_query($con, "insert into register values('','$first','$last','$phone','$age','$gender','$blood','$occupation','$qualification','$address','$image','$city')");
//echo "insert into addd values('','$name','$age')";
if($query1)
{
header("Location:http://localhost/dash/blood.php");
ob_end_flush();
die();
}
}
?>
<!DOCTYPE html>//HTML//
The problem will be executed on this line:
if($query1)
{
header("Location:http://localhost/dash/blood.php");
What I did
I changed localhost to the Server IP and it did not worked.
Even if I removed dash and just added blood.php it did not worked equal same error.
CMD:
Later on I executed the following command on cmd:
Result:
TCP 192.168.1.107:56487 93.184.220.29:80 WAIT 0
TCP 192.168.1.107:56494 193.247.41.48:80 WAIT 0
TCP 192.168.1.107:56512 185.73.44.35:80 SYN_SENT 6448
Are these connections the cause for my displayed error notification?
And if so, do I have to close these connections?