How To Connect Database in PHP

<?php
$host=”localhost”;
$user=”root”;
$pass=””;
$database=”databasename”;

$conn=mysql_connect($host,$user,$pass);
mysql_select_db($database);

$_GET = array_map(‘trim’, $_GET);
$_COOKIE = array_map(‘trim’, $_COOKIE);
if(get_magic_quotes_gpc()):
$_GET = array_map(‘stripslashes’, $_GET);
$_POST = array_map(‘stripslashes’, $_POST);
$_COOKIE = array_map(‘stripslashes’, $_COOKIE);
$_REQUEST = array_map(‘stripslashes’, $_REQUEST);
endif;

//$sql = ‘SELECT * FROM create_user’;
//
//$result=mysql_query($sql,$conn);
//
//    while($row = mysql_fetch_assoc($result)) {
//
//       echo $row[‘_company’];
//      }
?>

0

Leave a Reply

Your email address will not be published.
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>