I am trying to add a new column to my MYSQL table using PHP. I am unsure how to alter my table so that the new column is created. In my assessment table I have:
assessmentid | q1 | q2 | q3 | q4 | q5
Say I have a page with a textbox and I type q6
in to the textbox and press a button then the table is updated to:
assessmentid | q1 | q2 | q3 | q4 | q5 | q6
My code:
<?php
mysql_query("ALTER TABLE `assessment` ADD newq INT(1) NOT NULL AFTER `q10`");
?>
<form method="post" action="">
<input type="text" name="newq" size="20">
<input type="submit" name="submit" value="Submit">
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…