Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有
$updateSQL = sprintf("UPDATE stuffntory SET `youwho`=%s, stock=stock -1, list=%s WHERE something=%s",
而不是减号 -1 我想拥有由文本框输入的 -Quantity
更新您的格式以使用数量sprintf()占位符。假设数量是一个整数:
sprintf()
sprintf("UPDATE stuffntory SET `youwho`=%s, stock=stock - %d, list=%s WHERE something=%s", ...)