0

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.

3
  • stackoverflow.com/questions/9562124/… Commented Aug 22, 2016 at 9:00
  • It's a remote server. The most common reason for a timeout is that the server is behind a firewall that's blocking the MySQL port ( 3306 ). Commented Aug 22, 2016 at 9:04
  • I turned off my firewall but it gives me same error. Using mysqli connection dosen't cause the problem right? Commented Aug 23, 2016 at 1:16

1 Answer 1

0

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

iptables -A INPUT -p tcp --dport {mysql-port} -j ACCEPT 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.