1

我正在使用 Medoo,但对 php 知之甚少,下面的更新工作正常,但我只希望它在 clientId 与发布的内容匹配时更新:

$database->update("clientInfo", array(
 "businessName" => $_POST['businessName'],
     "contactName" => $_POST['contactName'],
     "businessEmail" => $_POST['businessEmail'],
     "businessPhone" => $_POST['businessPhone'],
     "businessWebsite" => $_POST['businessWebsite'],
     "businessAddress" => $_POST['businessAddress'],
     "businessAddress2" => $_POST['businessAddress2'],
     "businessCity" => $_POST['businessCity'],
     "businessState" => $_POST['businessState'],
     "businessZip" => $_POST['businessZip']
));

//$_POST["clientId"];

我正在使用较新版本的 PHP,对语法有点困惑,这是旧版本 PHP 的情况

http://medoo.in/api/update

4

1 回答 1

2

我假设您clientId在该表中有字段,您可以尝试:

$database->update("clientInfo", array(
     "businessName" => $_POST['businessName'],
     "contactName" => $_POST['contactName'],
     "businessEmail" => $_POST['businessEmail'],
     "businessPhone" => $_POST['businessPhone'],
     "businessWebsite" => $_POST['businessWebsite'],
     "businessAddress" => $_POST['businessAddress'],
     "businessAddress2" => $_POST['businessAddress2'],
     "businessCity" => $_POST['businessCity'],
     "businessState" => $_POST['businessState'],
     "businessZip" => $_POST['businessZip']
), array(
    "clientId" => $_POST['clientId']
));

希望能帮助到你。

于 2013-07-18T22:44:36.257 回答