|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
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.
|
|
#2
|
|||
|
|||
|
Maybe something like...
// put all column names in an array $cols=array("name", "age", "height"); $total=count($cols); $query="CREATE table table_name("; (for $i=0; $i<$total; $i++) { if($i != ($total-1)) $query.="$cols[$i] varchar(50)," else $query.="$cols[$i] varchar(50)); // no comma and end parentheses } I dunno...give it a shot |
|
#3
|
|||
|
|||
|
You add "rows" using INSERT.
You can add "columns" using ALTER TABLE |
|
#4
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Adding rows and columns to tables? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|