8. (A) Write a PHP code to create: 1. Create a database College 2. Create a table Department (Dname, Dno, Number_Of_faculty)
8. (A) Write a PHP code to create:
1. Create a database College
2. Create a table Department (Dname, Dno, Number_Of_faculty)
<?php | |
$con=mysql_connect("localhost","root",""); | |
if(!$con) | |
die('could not connect:'.mysql_error()); | |
if(mysql_query("create database College",$con)) | |
echo"Database Created successfully"; | |
else | |
echo "Error creating database:".mysql_error(); | |
mysql_select_db("College",$con); | |
$query="create table department(dname varchar(50),dno smallint,no_of_faculty smallint)"; | |
if(mysql_query($query,$con)) | |
echo"Table Created successfully"; | |
else | |
echo "Error creating table:".mysql_error(); | |
mysql_close($con); | |
?> |
8. (A) Write a PHP code to create: 1. Create a database College 2. Create a table Department (Dname, Dno, Number_Of_faculty)
Reviewed by admin
on
December 24, 2019
Rating:
No comments: