On Wed, 2002-02-06 at 07:51, Matt Rudderham wrote:
> Hi,
> I am making a form for editing the rows in a table. It displays each row
> as a row in a table(structure id tinyiny,name varchar(30) ), with the
> value inside a textbox so it can be changed. When doing the $submit to
> MySQL, I need do this:
> for($count=0;$count<=$i;$count++)
> {
> $current_id = $$count.-id;
> $current_name = $$count.-name;
> $sql = "UPDATE committee_names SET name ='$current_name' WHERE
> committee_id = '$current_id'"
> $result = mysql_query($sql);
> };
>
> Each time a record is displayed in the HTML table the textbox is given a
> name like $0-name then $1-name dynamically until all the records in the
> table have been displayed. Does anyone know how I can accomplish this?
Hi Matt,
This question is probably best answered by the PHP mailing lists. :)
However, before you go ask a question there, here are some tips:
Turn your error reporting up - there are several key errors in the
script that would be reported if error_reporting(E_ALL) were set.
There are PHP manual sections on strings and variable variables that
will help you out.
You may want to do this instead?
$sql = "UPDATE committee_names
SET name ='${count}-id'
WHERE committee_id = '${count}-name'";
Hrm. Any more and this would not be a MySQL mailing list. Please do
try the PHP lists. Visit http://php.net/support.php for more
information. You may wish to search the General mailing list archives
before posting - this is a fairly common question.
Good luck!
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Zak Greant <[EMAIL PROTECTED]>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB
/_/ /_/\_, /___/\___\_\___/ Calgary, Canada
<___/ www.mysql.com
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php