Reply to From form to db question

Your name:

Reply:


Posted by William Stokes on 04/24/05 13:26

Hello,

I writing a script that allows user to update a soccer league table with web
form. I made a script that prints the old values to text fields in the form.
It's done with a loop so that each text field name is numbered +1 higher
than previous.

My problem is how to put the changed data back to the DB with a different
loop since the variable names chance for every team.

Here's the a sample of the update part( only one column to update). This
script gets 14 game and team values from form
like this; $new_games1,$new_games2,$new_games3,$new_games4 etc (and same for
the $team).

$sql="SELECT name FROM x_series WHERE team_type = 'series'";
$result=mysql_query($sql);
$rounds = mysql_num_rows($result);
$count = 1;
while ($rounds >= $count) {

$sql = "UPDATE x_series SET games = '$new_games1' WHERE name = '$team1'";
mysql_query($sql);

$count++;
}

So how can get the game and team variables to change (+1) each time the sql
query is fired? Or can I? Is the alternative to write 14 different sql
queries? Sounds stupid.

Hope someone gets my idea and can help. I've been banging my head against
the wall with this and I'm running out of fresh ideas. I really wouldn't
want to write those separate sql queries for each update if its possible to
avoid that. Thanks a lot.

-William

[Back to original 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

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