---
title: "Connection in PHP"  
description: "Connection in PHP"  
author: "Amit Singh"  
published: 2010-10-18  
updated: 2010-10-18  
canonical: https://www.mindstick.com/forum/51/connection-in-php  
category: "php"  
tags: ["php"]  
reading_time: 1 minute  

---

# Connection in PHP

**[Connection](https://www.mindstick.com/articles/13012/what-makes-ethernet-connection-better-than-wifi) in [PHP](https://www.mindstick.com/articles/12149/php-constant-and-php-variables) we use this [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii):**

\

```
<?php //Start PHP statement
 $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); //this is the MySql connection function with passing parameter
 if (!$link) {
  die('Could not connect: ' . mysql_error()); //this is show the connection error
 }
 echo 'Connected successfully'; //It show the message connection successfully or not
 mysql_close($link); //connection close here
 ?> //End PHP statement
```


---

Original Source: https://www.mindstick.com/forum/51/connection-in-php

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
