Hi, hmm 2 ways para ma achieve ang gusto mo either through codes or through xammp admin.
here's the code. to create the table that you've said. you can save this as createdatabase.php
separate mo lang xa ng folder dun sa htdocs kasi isang beses mo lang i rurun tong code the to. otherwise
mag-eeror na xa kasi existing na yung database. then you can executet this line of codes like this, dun sa browser
http://localhost/foldername/createdatabase.php
Code:
<?php
//first connect ka muna dun sa host (mostly localhost)
//using the username and password
$host_provider = "localhost";
$host_username = "root"; //host username configuration
$host_password = "mysql"; //host password configuration
$connection_string = mysql_connect($host_provider, $host_username, $host_password);
if(!$connection_string){
echo "Cannot connect with the host, Please check the connection configuration ". mysql_error();
}else{
if(mysql_query("CREATE DATABASE databasename", $connection_string)){
mysql_select_db("datbasename", $connection_string);
$create_table = "CREATE TABLE persons
(
id int(4),
fname varchar(35),
lname varchar(35),
gender varchar(1),
email varchar(35),
school varchar(255),
enrollmentplan varchar(255)
)";
//execute query
if(mysql_query($create_table, $connection_string)){
echo "Database and its tabe has been successfully created";
}else{
echo "Failed to create database and its table";
}
mysql_close($connection_string);
}else{
echo "Failed to create database";
exit();
}
}
?>
Here's the second way. Through xammp admin
type mo sa browser:
http://localhost
then navigate ka sa baba, hanapin mo phpmyadmin. after you click the link. meron ka makikita sa middle page the create database. Type mo yung name ng database, then click create. After nun type mo name ng table at kung ilang field meron ang table na yun. CLick mo ang go button. After nyan itytype mo yun mga fields na kailangan example yung fname, lname etc. then kung anung datatype yung example varchar, int ect at kung ilang possible bytes of character. Most importantly yung id which is the primary key ng data mo.