That is what the autoincrement ID field is usually used for.
UPDATE mytable SET thisfield=newvalue where id=THISID;
Martin Skjöldebrand wrote:
>
> Hi,
>
> Now I'm completely stuck.
> I am codeing a (basic at this point) stock inventory in PHP/MySQL.
> I have all items in a table displayed in a table in PHP. Like this:
>
> if ($isstock >0) { //get value from a check on mysql_num_rows
> if ($action != "Edit") {
> for ($i = 0; $i <= $isstock -1; $i++) {
> $row = mysql_fetch_array($query_res);
> print "<tr>";
> print " <td>".$row['s_id']."</td>";
> print " <td>".$row['s_description']."</td>";
> print " <td>".$row['s_price']."</td>";
> print " <td>".$row['s_stock_quantity']."</td>";
> print " <td>N/I</td>";
> print " <td>N/I</td>";
> print " <td><input name='action' value='Edit' type='submit'><input
> name='action' value='Delete' type='submit'></td>";
> print "</tr>";
>
> }
> }
>
> Now I want to edit the specific ".$row['s_id']." How do I pass this to MySQL
> in a usefull manner? Is there a specific row number in a MySQL table I can
> access and pass to a variable?
> (Thought is too do something along the lines of (totally ficticous):
> $rownum = mysql_get_rownum($result);
> $rownum = "txtItem" . $rownum;
> and then <input type='hidden' name='Item' value='$rownum'>
>
> Any ideas?
>
> Martin S.
>
> ---------------------------------------------------------------------
> 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
---------------------------------------------------------------------
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