Showing posts with label MYSQL. Show all posts
Showing posts with label MYSQL. Show all posts

Sunday, November 20, 2011

How can you connect to MySQL from PHP?


Ans.  

Create a Connection to a MySQL Database
In PHP, this is done with the mysql_connect() function.
In the following example we store the connection in a variable ($con) for later use in the script. The "die" part will be executed if the connection fails:
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

// some code
?>

What are the current versions of apache, PHP, and MySQL?


Ans.  
 The current versions of apache is 
Stable Release:
2.2.21 (released 2011-09-13)

The current versions of PHP is
Stable Releases
Current PHP 5.3 Stable: 5.3.8

and The current versions of MySQL is
Stable release 5.5.17