2017-02-28 52 views
0

嗨,我想更新多列,我怎麼能?第一列是shoe1,想添加另一列,但不能如何更新SQL中的多列?

// 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"; 
+0

您好感謝爲d的答覆是一種方式ü可以使它對我來說更容易一些,就像使用上面的d代碼併爲我添加第二列這是(shoe2)謝謝 – david

回答

0

在一般的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 
+0

嗨,感謝您的回覆是一種方式,您可以使它更容易對我來說,就像使用d上面的代碼並添加對我來說第二列是(shoe2)謝謝 – david