Re: re-creating a variable name

From: Date: Fri, 05 Mar 2004 20:45:26 +0000
Subject: Re: re-creating a variable name
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-179604@lists.php.net to get a copy of this message
I could try and explain my problem again but it would be easier if I just include the code. <? if (isset($edit)) { $select = mysql_query("SELECT * from table"); $num_rows = mysql_num_rows($select); for($i=1;$i<=$num_rows;$i++){ $query = "Update table SET StartDate='$FormStartDate.=$i ' where id=$i"; $result = mysql_query($query) or die ("cannot update"); } } else { ?> <form method="post" name="edit server" action="<? echo $PHP_SELF ?>"> <? $query = mysql_query("SELECT * from table"); while ($row = mysql_fetch_array($query)) { $id = $row["id"]; $StartDate = $row["StartDate"]; ?> <input type=text name="FormStartDate<? echo $id ?>" size="15" value="<? echo $StartDate ?>"> <?}?> <input type="submit" name="edit" value="Update Date"></form> Because $FormStartDate1 is the name of the variable, I'm trying to recreate the name of the variable with the for loop after "edit" is submitted. Thanks again. Cory "Chris W. Parker" <cparker@swatgear.com> wrote in message news:001BD19C96E6E64E8750D72C2EA0ECEE2B8715@ati-ex-01.ati.local... Cory Berry <mailto:cberry@banknorth.com> on Friday, March 05, 2004 11:29 AM said: > Hello, I'm having difficulty dynamically creating a variable name for > mysql_query. [snip] > It doesn't execute. > Can someone tell me what I'm doing wrong. Any help would be greatly > appreciated. ?????? i have no idea what you are saying. care to reword your post? chris.

« previous php.general (#179604) next »