re-creating a variable name
| From: | Cory Berry | Date: | Fri, 05 Mar 2004 19:29:21 +0000 |
| Subject: | re-creating a variable name | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-179599@lists.php.net to get a copy of this message | ||
Hello, I'm having difficulty dynamically creating a variable name for
mysql_query.
I've tried using variable variables. I tried to re-create the sql string by
$a = "update table set startdate='$startdate"
$a .= $i ." ' where id=$i");
but that didn't work.
I'm dynamically creating each name of the input tag.
My input tag is: name=startdate<?echo id ?>
but when I use
$query = mysql_query("select * from table");
$num_rows = mysql_num_rows($query);
for($i=1;$i<=$num_rows;$i++){
$updatesql = mysql_query("update table set startdate='$startdate.=$i' where
id=$i");
}
It doesn't execute.
Can someone tell me what I'm doing wrong. Any help would be greatly
appreciated.
Thanks
Cory