You are here: Re: Comparing Data in two tables, « PHP Programming Language « IT news, forums, messages
Re: Comparing Data in two tables,

Posted by Jeff North on 06/18/05 02:33

On 17 Jun 2005 02:27:42 -0700, in comp.lang.php "Ian N"
<iannorton@gmail.com> wrote:

>| Hi, i was wondering if anyone would be able to help me with a problem
>| i'm having,
>|
>| I currently have two tables, in a database, one is Called products, and
>| one is called groupproducts, their are multiple groups which can be
>| added to or removed from.
>|
>| I want to creat a screen which lists all of the products and then
>| places a tick in a tick box if that products in the specified group.
>| >From this i'd submit it to another page which update the group
>| products.
>|
>| I'm currently doing the same system but having to edit it on a product
>| by product basis which is very time consuming!
>|
>| Any suggestions would be appreciated.

Updating multiple records from a single form is pretty easy (when you
know how) :-)

The trick is that you will need to associate the groupproducts
controls with each product. You can do this by:
<input name="prod<%php echp productid%>" value="<?php echo
productid%>|<%php echo groupdid%>" ...
This will result in the html code of:
<input name="prod101" value="101|1" ...
<input name="prod101" value="101|9" ...
<input name="prod101" value="101|5" ...
<input name="prod222" value="222|1" ...
<input name="prod222" value="222|9" ...
<input name="prod222" value="222|5" ...
When the form is submitted you will see this list of values which can
be exploded to separate the info.

The only problem here is that the names are dynamically generated so
you will not know, in advance, what to process. You will need to loop
through the $_GET or $_PUT item to extract this info.
The $_GET will look like:
&prod101=101|1&prod101=101|9&prod222=222|5&prod222=222|9

(my php is pretty woeful so I wont even attempt at giving you so
sample code).
---------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация