Page 1 of 1
insert into table
Posted: Fri Jan 23, 2004 4:13 pm
by vblifeline
lets say i had a table
1-jason
2-jessica
3-cerise
and i wanted to insert jeff into it like so
1-jason
2-jeff
3-jessica
4-cerise
how would i go about doing this
Posted: Fri Jan 23, 2004 4:22 pm
by ol4pr0
i do not have the time currently to look it up for you...
however i think i have read something with doing such things with arrays.
i also remember something about having them placed @ only in the end or just beginning however not sure...
You should start looking in arrays()
Posted: Fri Jan 23, 2004 5:13 pm
by Unipus
are you talking about a database table, an HTML table, what?
replay
Posted: Fri Jan 23, 2004 5:59 pm
by vblifeline
a database table
Posted: Fri Jan 23, 2004 6:11 pm
by vblifeline
a already have mysql setup and every thin and the data bases in there i want to insert data into the middle of the table becuase i have it setup all nice and pretty and in ordor i just wanted to know if there was a way of saying like "inset into table values('$name','$birth','$adress') where index = blah" does that work i dont think so but something like that i was woundering
Posted: Fri Jan 23, 2004 6:32 pm
by Unipus
That's a database design question, really, and it depends entirely on what you're really trying to do. For instance, is it really important that the data be in the database in that order, or do you just need it to display that way when you output it? What are the fields in your database? Is this the sort of thing you'll need to do frequently, or not?
Posted: Fri Jan 23, 2004 6:34 pm
by vblifeline
the data needs to be ordor that it lies in the data base
Posted: Fri Jan 23, 2004 6:36 pm
by vblifeline
thats why i need to insert in the middle of the data base
Posted: Fri Jan 23, 2004 6:42 pm
by Unipus
So what's the structure of your database right now?
Posted: Fri Jan 23, 2004 7:16 pm
by vblifeline
it has 6 feields index with is primary index unique auto increment and then all text feilds
Posted: Fri Jan 23, 2004 8:46 pm
by vblifeline
any help im sorry for the delay my comp is being really gay but i have it all fixed now
Posted: Sat Jan 24, 2004 3:35 am
by microthick
If you aren't sorting the records in a natural way (ordered by id ascendingly or descendingly, or by name alphabetically) you need to introduce your own scheme for doing so.
What I've done before is create another column called Sequence. And Sequence contains an integer which represents the order that you want it to appear in.
It's a bit of work to program, since if you insert one in the middle, you have to move each of the other items down one. Etc.