February 21st, 2000, 05:42 PM
I am creating a program for a company to allow them to edit the database through their website. The only difficulty I have run into is the editing of a tables' dimensions. I need to know how to add rows and columns or just create a table while running through a loop in PHP. Any help would be greatly appreciated.
February 21st, 2000, 10:58 PM
Maybe something like...
// put all column names in an array
$cols=array("name", "age", "height");
$query="CREATE table table_name(";
(for $i=0; $i<$total; $i++)
if($i != ($total-1))
$query.="$cols[$i] varchar(50)); // no comma and end parentheses
I dunno...give it a shot
February 22nd, 2000, 02:09 PM
You add "rows" using INSERT.
You can add "columns" using ALTER TABLE
March 6th, 2000, 06:06 PM
You give them a form that allows them to choose what they want to see, your program converts that to a query and displays the results. If you let them mess with the structure, you're almost certainly in for headaches.
Also, adding to existing rows uses UPDATE.