dave querubin
dave querubin

Reputation: 37

deploying project to domain, server error: Connection failed: Connection timed out

ns45.domaincontrol.com - Nameserver that godaddy gave me.

This is my connection.php

<?php 

$servername = "ns45.domaincontrol.com";
$username = "username";
$password = "password";
$dbname = "dailydok_doctordb";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

?>

This is my search.php

<?php 
include('connect.php');
if (isset($_POST['start_submit'])) {
 $neymSpec= $_POST['tx_DocNameSpec'];
 $place = $_POST['tx_Place'];

if($neymSpec == "" && $place == ""){
    $sql = "SELECT *,(select ROUND(FORMAT(avg(feedbacktbl.ratings),1),0) from `feedbacktbl` where feedbacktbl.DrNo = doctortbl.doctorID order by feedbacktbl.ratings desc) as 'TotalRating' FROM `doctortbl` order by doctorID desc";
    }
//process of sql
$result = $conn->query($sql);
$total_records = $result->num_rows;  //count number of records
if ($result->num_rows > 0) {
   while($row = $result->fetch_assoc()) {
     echo stripslashes($row['doctorName']) .". ";
        }
    }else {
    echo'<div class="alert alert-warning">The keyword you enter is invalid. Please try other keyword.</div>';
}
$conn->close();
}
?>

When I clicked the search button the error I'm getting is "Connection failed: Connection timed out".

I'm doing this for 3 days, and I can't get the answer, someone give me help. Thank you in advance.

Upvotes: 0

Views: 226

Answers (1)

BOUKANDOURA Mhamed
BOUKANDOURA Mhamed

Reputation: 1071

Check your firewall, add Mysql port, in linux something like this :

iptables -A INPUT -p tcp --dport {mysql-port} -j ACCEPT 

Upvotes: 0

Related Questions