Checkboxes with mySQL

From: Date: Fri, 07 Sep 2001 12:37:32 +0000
Subject: Checkboxes with mySQL
Groups: php.db 
Request: Send a blank email to php-db+get-12247@lists.php.net to get a copy of this message
I have a database with articles from which I can make a selection of which articles to show. This selection is made by a form with checkboxes. In the mysql table is a field called "pr". If there's a "1" in this field, the article should be shown for print, if there's a "0", it shouldn't. In the code I generate a form with all the titles and checkboxes. The checkbox values are the id's from the titles. When I click the button, I want to see my selection. The problem is this: What sql query can be used to proces the information from the checkboxes? At the moment I use in order to change the values in the database according to the checkbox selections: $query = mysql_query("UPDATE articles SET pr='1' WHERE id='$p[id]'"); But it does nothing! How can I insert multiple values (from the checkbox array) at one time in a database? Cilfa

« previous php.db (#12247) next »