visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Databases :: MySql :: Updating table from a HTML form using


By: ICT U.S.A.  Date: 07/02/2003 00:00:00  English  Points: 75 Status: Answered
Quality : Excellent
Hi

I am creating a process which reads a tables field names into an array and then uses this array to present the filed names with associated data for a particualr row in a HTML form. This same form is used to allow the user to enter/edit the data and on clicking "update" button I wish to use this same array of variables to update all the fields for that particular row of the table.

That is the code does not know the names of the fields.

My problem is the syntax of the mySQL update or insert or whatever command.

I think that makes sense.

Thanks

Ian
By: VGR Date: 07/02/2003 06:34:00 English  Type : Comment
no problem, I wrote one page like this for maintaining any DB I could have .

I suggest UPDATE if your unique id field of the table is declared auto_increment

This way, setting 0 in the id field provokes an insert, and letting in the existing value does an update

i think this is clear
By: bobbit31 Date: 07/02/2003 19:27:00 English  Type : Comment
what application server are you using? ASP/JSP/Other?
By: ICT Date: 08/02/2003 02:03:00 English  Type : Comment
Thanks for that,
in answer to the first comment, I am using php. Maybe my problem is more on the html to mysql side. That is, if I have a form in html with 10 edit fields how do I use arrays as the variables to read these values from the form so that I can then use this array to update on the mySQL command.

Ian


By: VGR Date: 08/02/2003 02:29:00 English  Type : Answer
it's not necessary to use an array, especially provided HTML has problems handling arrays (and matrices)

I use normal PHP variables whose names are F ("F" like "FORM" ;-) followed by the fields' name as from the DB

something like this :

${'F'.$globChNom[$globNbChamps-1]}

By: ICT Date: 09/02/2003 21:24:00 English  Type : Comment
Thanks VGR,

I will try and integrate your suggestion to see if this solves the problem.

Ian

Do register to be able to answer

EContact
browser fav
page generated in 342.618940 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page