Posted By:
16 Mar, 2014 3:44 am PDT

Creating table in MySQL through Php

How to create PHP Table using Mysql

 

<html>

<body>

<?php

$con=mysqli_connect("localhost","root","root","mydb");

if (mysqli_connect_errno())

{

echo "Failed to connect to MySQL Database: " .    mysqli_connect_error();

}

$sql="CREATE TABLE Information(FirstName CHAR(30),LastName CHAR(30),ID INT)";

if (mysqli_query($con,$sql))

  {

  echo "Table persons created successfully";

  }      

else

  {

  echo "Error creating table: ".mysqli_error($con);

  }

?>

</body>

</html>

 

/*Output of the above progam is:

Table persons created successfully

*/

 

Attachment: create.php


Creating table in Mysql using PHP.

This illustrate how table can be created in Mysql using Php.

Was it useful?  




Please login to reply to this problem.



Related Problems on Fixoncloud