insert into table

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vblifeline
Forum Newbie
Posts: 7
Joined: Fri Jan 23, 2004 4:13 pm

insert into table

Post 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
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post 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()
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

are you talking about a database table, an HTML table, what?
vblifeline
Forum Newbie
Posts: 7
Joined: Fri Jan 23, 2004 4:13 pm

replay

Post by vblifeline »

a database table
vblifeline
Forum Newbie
Posts: 7
Joined: Fri Jan 23, 2004 4:13 pm

Post 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
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post 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?
vblifeline
Forum Newbie
Posts: 7
Joined: Fri Jan 23, 2004 4:13 pm

Post by vblifeline »

the data needs to be ordor that it lies in the data base
vblifeline
Forum Newbie
Posts: 7
Joined: Fri Jan 23, 2004 4:13 pm

Post by vblifeline »

thats why i need to insert in the middle of the data base
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

So what's the structure of your database right now?
vblifeline
Forum Newbie
Posts: 7
Joined: Fri Jan 23, 2004 4:13 pm

Post by vblifeline »

it has 6 feields index with is primary index unique auto increment and then all text feilds
vblifeline
Forum Newbie
Posts: 7
Joined: Fri Jan 23, 2004 4:13 pm

Post by vblifeline »

any help im sorry for the delay my comp is being really gay but i have it all fixed now
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post 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.
Post Reply