duancan7914 2012-02-29 08:42
浏览 57
已采纳

如何使用php为特定行更新mysql数据库

I am going through certain rows in a table and am pulling multiple attributes for each product stored. One such item is quantity. The value for qt is pulled from the table and displayed in a textbox. The user should be able to change the quantity (from 1 to 2 for example) and the database should update for just that product chosen. Given I have the code below, how can I put together this functionality?

$query = "SELECT * FROM `sessionid` WHERE `sessionid` = '$session'  ";
$result = mysql_query($query) or die(mysql_error());
echo '<table class="table"><tbody>';

while($row = mysql_fetch_assoc($result)) {
echo '<tr><td><h3>' . $row['title'] . '</h3></td><td>' . $row['options'] . '</td><td><div class="span3 offset1"><input type="text" value="' . $row['qt'] . '" class="span1">    <h4> $' . $row['price'] . '</h4></td></tr>';
}

echo '<tr><td></td><td></td><td><a href="#" class="btn"><i class="icon refresh"></i>Refresh</a></td></tr></tbody></table>';
  • 写回答

1条回答 默认 最新

  • doubaisui2526 2012-02-29 08:54
    关注

    you have to use a FORM in your html code:

    http://php.about.com/od/phpbasics/ss/mysql_files.htm

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
  • ¥15 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效