gpt4 book ai didi

php - 如何在SQL中更新多列?

转载 作者:行者123 更新时间:2023-11-29 10:59:20 25 4
gpt4 key购买 nike

您好,我正在尝试更新多列,我该怎么办?第一列是shoe1,想添加另一列但不能

// shoe1
$query = "SELECT shoe_id, shoes_image,
shoes FROM " . $DBPrefix . "shoes";

$params[] = array(':shoe_id', floor($time_passed), 'int');
$db->query($query, $params);

$TPL_shoe1_list = '<select name="shoe1">' . "\n";

while ($row = $db->fetch())
{
$selected = ($row['shoes'] == $shoe1) ? 'selected="true"' : '';
$TPL_shoe1_list .= "\t" . '<option value="' . $row['shoes'] . '" ' . $selected . '>' . $row['shoes'] .'</option>' . "\n";
}

$TPL_shoe1_list .= '</select>' . "\n";

最佳答案

一般来说sql语法是

UPDATE table-name 
SET column-name = value, column-name = value, ...
WHERE condition

示例:

UPDATE Supplier
SET City = 'Oslo', Phone = '(0)1-953530', Fax = '(0)1-953555'
WHERE Id = 15

关于php - 如何在SQL中更新多列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42519761/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com