- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试编写一个为商店保留产品的脚本。它应该通过将数据发送到 mysql 数据库来工作,然后返回“shop”中的值。代码如下; 查看店铺
<form action="reserveitems3.php" method="POST">
<?php
// Connects to your Database
mysql_connect("localhost", "dbname", "password") or die(mysql_error()) ;
mysql_select_db("dbname") or die(mysql_error()) ;
//Retrieves data from MySQL
$data = mysql_query("SELECT * FROM products") or die(mysql_error());
//Puts it into an array
while($info = mysql_fetch_array( $data )) {
// render each dtabase result and wrap in a div
echo "<div class='product'>";
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
echo "<tr>
<td class='image'><img src=http://my-creativewebfusion.com/mysql_data/file/".$info['photo'] . "></td>
<td class='name'>".$info['name'] . "<br/><br/>".$info['desc'] . "</td>
<td class='phone'><input name='".$info['id']."' type='checkbox' value='yes' style='position:relative;float:right;right:50px;' class='checked' onclick='document.getElementById('other').innerHTML = 'Check Box = ' + this.checked;'/><br/><br/>
<div class='alignright'>Price: ".$info['price'] . "</div>
<div class='alignright'>QTY: <input type='text' name='reserve' style='width:40px;'/></div>
<div class='alignright'> ";
$sum_total = $info['stock'] - $info['reserve'] ;
if ($sum_total == 0)
{
echo "<p style='color:red;'>Out of stock</p>";
}
else
{
echo "<p style='color:green;float:right;'>",($sum_total)," In stock</p> ";
echo "<p style='color:green;'>".$info['reserve']." Reserved</p>";
}
echo "</div></td></tr>";
echo "</table>";
echo "</div><input type='submit' value='Submit' />";
}
?>
</form>
这是预留项目php文件
<?php
// Connects to your Database
mysql_connect("localhost", "dbname", "password") or die(mysql_error()) ;
mysql_select_db("dbname") or die(mysql_error()) ;
//This gets all the other information from the form
$reserve=$_POST['reserve'];
//Writes the information to the database
mysql_query("UPDATE products SET reserve= reserve + '$reserve' WHERE id ='$id'");
$result = mysql_query($sql) or die(mysql_error());
?>
它返回错误并且不更新。非常感谢任何帮助。
谢谢
最佳答案
您正在尝试将字符串($reserve 括在引号中)添加到数字中。尝试删除更新查询中的引号,即:
mysql_query("UPDATE products SET reserve= reserve + $reserve WHERE id ='$id'");
关于php - 产品预订脚本 PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16671697/
我正在为一家小型酒店开发预订系统。我非常擅长 PHP,但不太擅长 SQL...我制作了一个表格,您可以在其中输入您的信息、房间数量并使用日历选择到达日期和退房日期。 现在一切都很顺利,直到我不得不检查
我有一个租车脚本。我把汽车放在汽车 table 上。我将所有预订信息保存在预订表中。预订表有开始日期和结束日期字段以及 car_id 字段。 例如:car_id: 14, from="2014-06-
我最近被问及一个关于假设的基于 Web 的预订系统的面试问题,以及我将如何设计数据库架构以最大限度地减少重复并最大限度地提高灵 active 。 用例是管理员将属性的可用性输入系统。可以设置多个时间段
如何在 中使用标签式标题预订 像 RMarkdown 一样? 在 RMarkdown 中: # heading1 {.tabset} ## tab1 content1 ## tab2 content2
我使用 Woothemes booking对于我的 woocommerce 网站 当我为产品建立自定义搜索时,我还必须搜索可用性,这是我应该如何管理来自 B.O 的可用性以及插件如何存储到数据库 a:
我正在尝试找到一种在亚马逊中按 ISBN 查找书名的简单方法。我正在协助我 child 的学校做一个简单的 list 。我的测试集中的很多书籍都无法使用其他来源(尝试使用 Google、WorldCa
我正在使用 JQuery-Mobile 在浏览器中开发一个房间预订应用程序。最初,我将预订建模为带有时间戳的记录和带有持续时间的字段。 现在,如果我有一个表/div,每个表代表一天的 15 分钟,那么
我有一个自托管 NancyFX Web 服务器的桌面应用程序。作为一个桌面应用程序,我们需要允许动态 IP 地址,因此我们使用 netsh 的通配符选项注册了 url,如下所示: netsh http
我有一个关于 x++ 和循环内容的问题要问。首先,这是代码: class MixFor5 { public static void main(String[] args) { int x = 0;
我在为带有等候名单的预订类型系统设计算法时遇到困难。 在任何给定时间都可以有 3 个活跃插槽,每个插槽持续一个月,之后它们将被放入等待列表中。我希望能够插入项目从等待状态转为事件状态的日期。 我知道三
我正在制作一个 session 室预订系统,您可以在其中选择特定的时间段,然后您应该在那时获得可用的房间。一些表的名称是法语,因此我将在需要时提供 () 之间的含义。我的问题是,当我选择时间时,我什至
我开始了一个新项目: 我只运行以下命令: rails g model subscription 然后: rails g controller subscriptions 然后: 已将resources
我正在通过一个 api 发布一个现场预订请求。当我通过一个表单操作发布数据并提交时,我会得到回复。但是当我试图通过 curl 发布相同的 url 以获得响应时,我没有得到任何数据。 网址是:- htt
已结束。此问题不符合 Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的非现场资源的问题对于 Stack Overflow 来说是无关紧要的
我想知道有用的资源/书籍,它们将有助于初学者学习网络服务器、应用程序服务器和网络架构基础知识。 我正在尝试了解不同的服务器如何相互交互。浏览器如何向服务器发送请求以及服务器如何发送响应。我有兴趣了解这
我正在开发一个项目,用户可以在餐厅进行预订,但仅限于餐厅允许的日期。餐厅还可以设置特定时间有多少个座位。 因此,餐厅可以提供每周格式的时间表,但也可以提供异常(exception)情况(例如假期)。
我正在尝试为以下计划改进 SQL: 看起来像这样: - @users.each do |user| - @dates.each do |date| %td - Booking.
我正在使用 WooCommerce 预订插件,我目前希望在预订摘要(产品选项)中显示其他信息。 为此,我使用了以下钩子(Hook):woocommerce_admin_booking_data_aft
请让我了解保留所有 ec2 实例时 ssd 的费用,那么为什么每 GB 月会扣除 0.10 美元? 我已经保留了 c4.2xlarge 和 m4.xlarge 实例,但仍然会从账单中连续扣除费用,仅针
我想知道是否有办法使用 Woocommerce 预订自动设置可预订产品的开始日期和结束日期。我想要实现的是,当用户进入我的产品页面时,开始日期和结束日期(月、日和年)将根据我希望通过 Jquery 设
我是一名优秀的程序员,十分优秀!