我试图将1或1添加到行中,如下所示:
public static void Main()
{
string one = @"C:\aaaa\bbbb\cccc";
string two = @"cccc\dddd";
int overlapIndex = one.IndexOf(two.Split('\\').First());
string three = one.Substring(0, overlapIndex) + two;
Console.WriteLine(three);
// "C:\aaaa\bbbb\cccc\dddd"
}
但数量和购买在每个查询中都为0。我不知道为什么
答案 0 :(得分:0)
您错过了正确的mysql UPDATE
语法,因为当您想要更新多个列时,,
而不是AND
。点击此处https://dev.mysql.com/doc/refman/5.0/en/update.html
UPDATE t1 SET col1 = col1 + 1, col2 = col2 - 1;
^^^
对于您的查询,
$updatequality = $database->prepare("UPDATE products SET quantity=quantity - 1 , purchases=purchases + 1 WHERE id=?");