I'm hosting my php file in WAMPSERVER PHP Version 5.4.3 and my database is somewhere in the uni server
I keep getting this error and I don't know why
* A connection attempt failed because the connected party did not properly respond after a period of time or established connection failed because connected host has failed to respond. in C:\wamp\www\test3.php on line 4*

However I also tried to host the php file in the uni server with PHP Version 5.4.11

and I get this error when I use mysql_connect or my mysqli_connect

Call to undefined function mysqli_connect() *
*Call to undefined function mysql_connect()

I'm so frustrated I don't know what else to do I think I've tried everything but it not working for me please help

this is my code

<?php
//Create the connection  

$con = mysqli_connect("xxx","student","student4","student4DataBase") or die("Some error occurred during connection " );
//. mysqli_error($con));  

// Write query

$strSQL = "SELECT SID FROM TABLE_STUDENT";

// Execute the query.

$query = mysqli_query($con, $strSQL);
while($result = mysqli_fetch_array($query))
{
  echo $result["SID"]."
";
}

// Close the connection
 mysqli_close($con);

?>

First, even though this is a student account you should probably get in the habit of not posting your connection data for databases (or any password, really).

The error you are getting is most likely caused by a missing module for PHP/MySQL.

So, the first question is - do you have access to this box? Do you have permissions to install files / software?

If not, you may need to ask your teacher / sysadmin what database connection drivers you have available. Since you're on windows, you may have to use ODBC instead of the MySQL driver, in which case you may have a lot more work ahead of you :-/

If you do have access, and can restart, this may be of help to you:
http://stackoverflow.com/a/17638233

TL;DR:
Download this: http://www.dll-files.com/dllindex/dll-files.shtml?libmysql
Install it here: C:\windows\system32.
Restart Apache

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.