本文整理汇总了PHP中Clients::addClient方法的典型用法代码示例。如果您正苦于以下问题:PHP Clients::addClient方法的具体用法?PHP Clients::addClient怎么用?PHP Clients::addClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Clients
的用法示例。
在下文中一共展示了Clients::addClient方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
foreach ($_POST['client_car'] as $key => $value) {
if (empty($value['make'])) {
$errors++;
$issues[] .= 'Please enter car no. ' . $key . ' make';
}
if (empty($value['registration'])) {
$errors++;
$issues[] .= 'Please enter car no. ' . $key . ' registration';
}
}
if ($errors === 0) {
// if it's all ok insert data into database
$data = array('client_name' => $client_fname . ' ' . $client_lname, 'client_username' => $client_username, 'client_password' => $client_password, 'client_salt' => $client_salt, 'client_email' => $client_email, 'client_phone' => $client_phone);
$Clients = new Clients();
if ($Clients->addClient($data) === true) {
// if client was added, add the cars too
foreach ($_POST['client_car'] as $car) {
$data = array('ccar_make' => $car['make'], 'ccar_registration' => $car['registration']);
$Clients->addClientCar($data, $Clients->_LastId);
}
echo '<div class="alert alert-success">Client <strong>' . $client_fname . ' ' . $client_lname . '</strong> was added (no redirect for debug purposes)</div>';
} else {
echo '<div class="alert alert-danger">Could not reach database</div>';
}
} else {
echo '<div class="alert alert-danger">';
echo '<div><strong>Correct the following errors:</strong></div>';
foreach ($issues as $issue) {
echo '<div>' . $issue . '</div>';
}