⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Multiple record edit?



Bonker
  • profile picture
  • Member

Posted 13 June 2012 - 15:29 PM

I have a simple crud to manage internal IP addresses. If a user is assigned multiple ip's, like in a lab setting, I'd like to assign them all in the table in one operation. Is there a way to edit multiple records simultaneously? Something like a grid edit function or at least checkbboxes to select multiple records before clicking edit would be really helpful.

fdias
  • profile picture
  • Member

Posted 13 June 2012 - 17:39 PM

Why not use a n to n relationship?
If you already have the IPs registered you can assign them to any user.

Check the example below:

http://www.grocerycrud.com/examples/set_a_relation_n_n

Hope it helps.

Cheers.

Bonker
  • profile picture
  • Member

Posted 14 June 2012 - 14:12 PM

I have 10 columns not including id and ip and they can all change from experiment to experiment. It's a telecommunications lab and things are fairly fluid concerning the networking.

Here's a case:

Daffy Duck has to configure 6 servers and several gateways. Instead of going through the IT services ticket fiasco, he open up my little program - thank you GC - and updates the records he needs. The extra steps involved with opening each record and setting fields with duplicate data(user), and unique data(hostname), is bugging some of my "customers".

Another department has implemented their lab management db interface using PHPMaker. Gah! It works perfectly and has inline record editing within the table and also a full grid edit capability. No, I'm not going to use a code generator.

I like the n_n relation idea but I'm weak on DB skills so maybe some guidance on how to implement this in my situation would be fantastic!

Thanks!

kenvogt
  • profile picture
  • Member

Posted 14 June 2012 - 19:32 PM

You will need three tables, something like this:

users
id
name

users_ips
id
user_id
ip_id

ips
id
ip_address

Then you can use the docs for set_relation_n_n to create the relationships.

Bonker
  • profile picture
  • Member

Posted 27 June 2012 - 15:02 PM

Thank you! I will followup after I put it in place and my users try it out.