multiple row form

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
fugaki
Forum Newbie
Posts: 1
Joined: Thu Jun 19, 2008 11:32 am

multiple row form

Post by fugaki »

I want to make a page that spits out a range of data, all from different rows in the table, but I cant seem to figure out how I go about running multiple queries, with the exception of naming things like $field1row1, $field2row1, $field1row2 etc., but that kind of limits me to a set number of rows in the table, where I need it to be dynamic.
Is there an easy way to pass the data accross and have it run multiple queries?
Example:
Row 1 values - 2 1
Row 2 values - 3 2

send to page with query, and I do
update table set field1='2',field2='1' where whatever determines row 1
update table set field1='3',field2='2' where whatever determines row 2

Thanks for any help.
mrgooding
Forum Newbie
Posts: 23
Joined: Thu May 22, 2008 11:45 am

Re: multiple row form

Post by mrgooding »

I'm a bit of a beginner at php myself, but I think I understand what you want to do

I guess first, get a count of how many rows you have, then do a while loop through, reading all the values within each row, and recording them into an array. I'd guess after that you'd want to spit these values out into forms, so you'd be able to update numerous rows at the same time - am I correct here?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: multiple row form

Post by califdon »

fugaki wrote:I want to make a page that spits out a range of data, all from different rows in the table, but I cant seem to figure out how I go about running multiple queries, with the exception of naming things like $field1row1, $field2row1, $field1row2 etc., but that kind of limits me to a set number of rows in the table, where I need it to be dynamic.
Is there an easy way to pass the data accross and have it run multiple queries?
Example:
Row 1 values - 2 1
Row 2 values - 3 2

send to page with query, and I do
update table set field1='2',field2='1' where whatever determines row 1
update table set field1='3',field2='2' where whatever determines row 2

Thanks for any help.
I don't really understand what you want to do. Can you be more specific? Instead of generalities such as "a range of data", show us what kind of data is in your table(s) and what you want it to look like when it is displayed.
Post Reply