Is it possible to add new field without editing my database but using PHP code or jquery to insert new field in my database, so let's say i have a table name MAIN
with (COL1 ,COL2)
and in my PHP code/jquery will insert new field (COL 3)
in my database. Is it possible?
$result=("SELECT * FROM main");
$res = $conn->query($result);
if(isset($_POST['Add'])){
if(empty($_POST['ParentCreate'])){
echo "Fill up the textbox";
}else{
$sql = "ALTER TABLE tablemain ADD COLUMN
'".$_POST['ParentCreate']."' VARCHAR(100) NOT NULL COMMENT '' AFTER
main_one";
$conn->query($sql);
echo "New Field created";
}
}
-----------------------------------
<body>
<div id="frm_div">
<form id="frm1" action="">
<input type="text" name="ParentCreate" placeholder="ParentCreate" />
<input type="submit" name="Add" value="Add" />
</form>
</div>
<div id="result">
<?php
if($res!=""){
while($row=$res->fetch_row()){
echo $row[0]."<br/>";
echo $row[1]."<br/>";
}
}else{
echo "Nothing Found";
}
?>
</div>