creating a database using sql command

creating a database using sql command

creating-database-using-sql-command.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>creating a database using sql command</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="Author" content="Md Iqbal Hosan">
  <meta name="title" content="creating a database using sql command">
  <meta name="keywords" content="php, example, code, database, sql command, sql, creating database">
  <meta name="description" content="creating a database using sql command">
  <style>
   h2, h4{background:#eee; color:#000085;}
   h2{ padding:3px; margin:3px; font-size:22px;}
   h4{ padding:2px; margin:2px; font-size:19px;}
   p{padding:2px; margin:2px; color:#0099FE;}
   body{ background:#FFFFFA;}
  </style>
 </head>
 <body>
  <h2>creating a database using sql command</h2>
  <pre>
   <?php
    /*
     ---------------------------------------------------------------------
     WE WANT A HR DATABASE TO MANAGE (HUMAN RESOURCE) OF AN ORGANIZATION
     AND WE WANT TO DO IT BY USING SQL COMMAND IN MYSQL DB SERVER
     ---------------------------------------------------------------------
    */
    $sql = "CREATE DATABASE HR";
    /*
     -----------------------------------------------------------------------
     ALSO YOU CAN USE [IF NOT EXISTS] EXPRESSION WHILE CREATIONG A DATABASE
     -----------------------------------------------------------------------
    */
    $sql = "CREATE DATABASE IF NOT EXISTS HR";
    /*
     ----------------------------------------------------
     USING PHP WE CAN ALSO DO THIS. 
     GET CONNECTION TO DATABASE BY USING mysql_connect()
     THEN RUN THE QUERY
     ----------------------------------------------------
    */
    
    mysql_connect('localhost', 'root', 'root');
    mysql_query($sql);
    
    /*
     --------------------------------------------------------
     TO RUN THE PHP CODE PROVIDE REAL DATA TO mysql_connect
     --------------------------------------------------------
    */
   ?>
  </pre>
 </body>
</html>

creating a database using sql command - output in the client

No comments:

Post a Comment

leave your comments here..