- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我知道有很多关于这个的话题,我都看过了,但它们对我没有帮助。我的表名是正确的,没有空格或任何异常的东西。我检查了 100 次,然后又检查了 100 次。我将发布我的两段代码,希望有人能提供帮助。
当我尝试使用提交按钮时出现此错误:更新赔率时出错:“字段列表”中的未知列“homeOdds”
发布:
if ($_POST['action'] == 'Update') {
foreach($_POST['game'] as $game) {
$homeScore = ((strlen($game['homeScore']) > 0) ? $game['homeScore'] : 'NULL');
$homeOdds = (str_replace("\xBD", ".5", $homeScore));
$visitorScore = ((strlen($game['visitorScore']) > 0) ? $game['visitorScore'] : 'NULL');
$visitorOdds = (str_replace("\xBD", ".5", $visitorScore));
$sql = "update " . $db_prefix . "schedule ";
$sql .= "set homeOdds = '" . $homeOdds . "', visitorOdds = '" . $visitorOdds . "' ";
$sql .= "where gameID = " . $game['gameID'];
mysql_query($sql) or die('Error updating odds: ' . mysql_error());
}
header('Location: index.php');
}
表格/表格和更新按钮:
<form id="scoresForm" name="scoresForm" action="odds.php" method="post">
<input type="hidden" name="week" value="<?php echo $week; ?>" />
<?php
$sql = "select s.*, ht.city, ht.team, ht.displayName, vt.city, vt.team, vt.displayName ";
$sql .= "from " . $db_prefix . "schedule s ";
$sql .= "inner join " . $db_prefix . "teams ht on s.homeID = ht.teamID ";
$sql .= "inner join " . $db_prefix . "teams vt on s.visitorID = vt.teamID ";
$sql .= "where weekNum = " . $week . " ";
$sql .= "order by gameTimeEastern";
$query = mysql_query($sql);
if (mysql_num_rows($query) > 0) {
echo '<table cellpadding="4" cellspacing="0" class="table1">' . "\n";
echo ' <tr><th colspan="6" align="left">Week ' . $week . '</th></tr>' . "\n";
$i = 0;
while ($result = mysql_fetch_array($query)) {
$homeTeam = new team($result['homeID']);
$visitorTeam = new team($result['visitorID']);
$rowclass = (($i % 2 == 0) ? ' class="altrow"' : '');
echo ' <tr' . $rowclass . '>' . "\n";
echo ' <td><input type="hidden" name="game[' . $result['gameID'] . '][gameID]" value="' . $result['gameID'] . '" />' . date('D n/j g:i a', strtotime($result['gameTimeEastern'])) . ' ET</td>' . "\n";
echo ' <td align="right"><input type="hidden" name="gameID[' . strtolower($visitorTeam->team) . ']" value="' . $result['gameID'] . '" />' . $visitorTeam->teamName . '</td>' . "\n";
echo ' <td><input type="text" name="game[' . $result['gameID'] . '][visitorScore]" id="game[' . $result['gameID'] . '][visitorScore]" value="' . $result['visitorOdds'] . '" size="3" /></td>' . "\n";
echo ' <td align="right"><input type="hidden" name="gameID[' . strtolower($homeTeam->team) . ']" value="' . $result['gameID'] . '" />at ' . $homeTeam->teamName . '</td>' . "\n";
echo ' <td><input type="text" name="game[' . $result['gameID'] . '][homeScore]" id="game[' . $result['gameID'] . '][homeScore]" value="' . $result['homeOdds'] . '" size="3" /></td>' . "\n";
echo ' </tr>' . "\n";
$i++;
}
echo '</table>' . "\n";
}
?>
<br><input type="submit" name="action" value="Update" />
</form>
感谢任何帮助。
最佳答案
为了调试它,在将它提交到数据库之前,回显(或 var_dump)包含在 $sql
变量中的动态生成的 SQL。
然后将该语句带到另一个客户端进行测试。
MySQL 告诉您您正在引用的表 schedule
不包含名为 homeOdds
的列。
我们看不到被合并到 SQL 文本中的所有变量的内容。 (该代码似乎容易受到 SQL 注入(inject)攻击。
关于php - 'xxxxxx' 中的未知列 'field list',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31926958/
我需要用这种格式写一个正则表达式:XXXXXX.XX可以少于6位,.XX部分是可选的。 function checkFormat(el) { var ex = new RegExp(/ ^[0
我想更改管理员最近更改侧边栏如何显示添加的“对象”名称的默认行为。引用下图: 我想更改这些在管理员中的命名方式。理想情况下,我希望能够将其从“MyModelName 对象”更改为“策略”对象示例中的“
在我的导航栏中有这段代码。 about\a 所有 div 在这种情况下所做的就是将文本放在适当的位置,而在 a.hl 中它是 - a.hl{ background-color:#000; text-d
当我尝试构建和运行我的应用程序时,它崩溃了,我在日志中得到了这个: reason: '[ setValue:forUndefinedKey:]: this class is not key value
如何提取以 #rrggbb 形式给出的颜色的色调分量? 最佳答案 如果你search关于如何将 RGB 转换为 HSL,您会找到许多算法,包括在 Sergey 链接的维基百科文章中。 . 首先,提取十
我知道有很多关于这个的话题,我都看过了,但它们对我没有帮助。我的表名是正确的,没有空格或任何异常的东西。我检查了 100 次,然后又检查了 100 次。我将发布我的两段代码,希望有人能提供帮助。 当我
我有一个与远程 mysql 服务器通信的软件。更新远程主机上的 mysql 后,我得到 2014-07-04 10:11:39.8750Access denied for user 'xxx'@'xx
我安装了bind在 CentOS 6 服务器上配置 DNS 区域以定义域。我的 /etc/named.conf这是: options { # listen-on port 53 { 1
我已经使用 leiningen REPL 定义了以下 3 个函数: (defn rand-int-range [floor ceiling] (+ floor (rand-int (- ceiling
我正在使用适用于 STM32F4 的 gcc ARM 编译器编译别人用 C 编写的代码 #define ESC_CSR_CMD_BUSY BIT(31) #define ESC_CSR
float fRealEsate = 360000.00 * 0.04; Toast.makeText(v.getContext(), "Real Estate Brokerage Fee: "
在 WinCrypt.h 中我看到: #define CERT_CHAIN_POLICY_SSL ((LPCSTR) 4) WINCRYPT32API BOOL WINAPI CertVerify
我正在使用 Xcode6.0.1。我正在尝试使用 Application Loader 提交我的应用程序。但它给了我这个错误: CFBundleIdentifier为'com.jiazhong.ios
我一直很好奇这些注释包含 mysqldump 为我生成的类似预处理器的语句是什么意思。这是一个例子: /*!40000 ALTER TABLE abc DISABLE KEYS */; 一般模式似乎是
我在 Visual Studio 2012 RC 中有一个小型 C/C++ 项目 此应用程序解析 argv,然后使用 ShellExecute 调用另一个 .exe 文件 我的应用程序在 Window
如果字符串的模式为XxxXyzAbc... sed 的预期输出必须是 Xxx Xyz Abc ... 例如:如果字符串是QcfEfQfs,则预期输出是Qcf Ef Efs。 如果我尝试用空格替换模式[
我正在开发一个 IOS 应用程序,在使用我自己的 apple id(个人团队)之前,我已经成功地将它发布到应用程序商店。今天我关闭我的xcode并重新打开它,然后我想将我的apple id(已经注册了
我将以下环境变量添加到我的项目中并将其值设置为 YES。 NSDebug已启用 NSZombie启用 MallocStack日志记录 MallocStackLoggingNoCompact 我遵循ht
您好,需要沿反斜杠(/) 去除字符串 例如我有 String vret = "Comment Four/Y/34147/D_Z"; 这必须分成 4 个字符串 Str sarr[]={comment,Y
我正在使用 GridSerach 来搜索分类器的最佳超参数,如下所述:http://scikit-learn.org/stable/auto_examples/model_selection/plot
我是一名优秀的程序员,十分优秀!