dynamics variables

From: Date: Wed, 14 Jun 2000 03:43:18 +0000
Subject: dynamics variables
Groups: php.db 
Request: Send a blank email to php-db+get-396@lists.php.net to get a copy of this message
Hello, I'm French, so excuse me for my poor English. I use PHP3 and My SQL I want to make a first php page which can list many column of a database. In this first page, I want that my user can modify some information in every column. Then they submit this information to a second page which replace every column with the new data. My problem is that I don't know how many columns I have in the database and so how many variables I have. In every column, I want to modify the variable "ordre" and "visible". Can you give me a way to do that. this is my code: <?php include ("../connection.inc"); include ("../header.inc"); include ("../footer.inc"); connection () or die ("probleme de connexion avec la base de donnee des comediens"); function carte_publier () { global $PHP_SELF, $etape; if ($etape == 1) { html_header (); print ("<center>"); print ("<h2><font face=\"Times New Roman,Georgia,Times\">La carte du jour</font></h2>"); print ("</center>"); printf ("<FORM METHOD=\"post\" ACTION=\"%s?etape=2\">\n", $PHP_SELF); $carte_section_query = "SELECT carte_section_id, nom, image_url, ordre FROM carte_section ORDER BY ordre"; $carte_section_result = mysql_query ($carte_section_query) or die ("le programme ne peut pas afficher la liste des sections de la carte"); while($carte_section_row = mysql_fetch_array ($carte_section_result)) { $carte_section_id = $carte_section_row["carte_section_id"]; $carte_section_nom = $carte_section_row["nom"]; $carte_section_image_url = $carte_section_row["image_url"]; printf ("<p><font face=\"Times New Roman,Georgia,Times\">%s :</font></p>", $carte_section_nom); $carte_query = "SELECT carte_id, nom, prix, visible, ordre FROM carte WHERE carte_section_id = $carte_section_id ORDER BY ordre, carte_id"; $carte_result = mysql_query ($carte_query) or die ("le programme ne peut pas afficher la liste des elements de la carte"); while($carte_row = mysql_fetch_array ($carte_result)) { $carte_id = $carte_row["carte_id"]; $carte_nom = $carte_row["nom"]; $carte_prix = $carte_row["prix"]; $carte_visible = $carte_row["visible"]; $carte_ordre = $carte_row["ordre"]; print ("<p><font face=\"Times New Roman,Georgia,Times\">"); if ($carte_visible != "oui") { print ("<input type=\"checkbox\" value=\"non\" name=\"visible\">"); } else { print ("<input type=\"checkbox\" value=\"oui\" name=\"visible\" checked>"); } printf ("<input type=\"text\" name=\"ordre\" size=\"5\" value=\"%s\"> %s &agrave; %s F</font></p>", $carte_ordre, $carte_nom, $carte_prix); } } print ("<p><input type=\"submit\" value=\"publier\" name=\"submit\">"); print (" </FORM>\n"); } elseif ($etape == 2) { html_header (); print ("<center>"); print ("<h2><font face=\"Times New Roman,Georgia,Times\">La carte du jour est en ligne!</font></h2>"); print ("</center>"); } else { } } carte_publier (); html_footer (); ?> Thanks, Julien Rault julien.rault@servapp.fr 06 14 39 40 83

« previous php.db (#396) next »