本文整理汇总了PHP中Vendor::find_by_vendid方法的典型用法代码示例。如果您正苦于以下问题:PHP Vendor::find_by_vendid方法的具体用法?PHP Vendor::find_by_vendid怎么用?PHP Vendor::find_by_vendid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vendor
的用法示例。
在下文中一共展示了Vendor::find_by_vendid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create()
{
if (!empty($_POST['vendid']) && !empty($_POST['compname']) && !empty($_POST['phone']) && !empty($_POST['email'])) {
if (Vendor::find_by_vendid($_POST['vendid'])) {
return 4;
//Cannot enter Duplicated vendor ID
exit;
}
$newVendor = new Vendor();
if (isset($_FILES['fupload']) && $_FILES['fupload']['error'] == 0) {
//if file upload is set
move_uploaded_file($_FILES['fupload']['tmp_name'], "public/uploads/" . basename($_FILES['fupload']['name']));
$image = new Imageresize();
// an instance of image resize object
$image->load("public/uploads/" . basename($_FILES['fupload']['name']));
//$image->image =;
$image->resize(400, 400);
$image->save("public/uploads/" . basename($_FILES['fupload']['name']));
//this section is needed to get the extension for image type in renaming the image
if ($_FILES['fupload']['type'] == "image/gif") {
$ext = ".gif";
}
if ($_FILES['fupload']['type'] == "image/png") {
$ext = ".png";
}
if ($_FILES['fupload']['type'] == "image/jpeg") {
$ext = ".jpeg";
}
if ($_FILES['fupload']['type'] == "image/pjpeg") {
$ext = ".jpeg";
}
if ($_FILES['fupload']['type'] == "image/gif") {
$ext = ".gif";
}
if ($_FILES['fupload']['type'] == "image/jpg") {
$ext = ".jpg";
}
$new_name = uniqid() . "_" . time() . $ext;
//new name for the image
rename("public/uploads/" . basename($_FILES['fupload']['name']), "public/uploads/" . $new_name);
$photo = $new_name;
$newVendor->img_url = $photo;
} else {
//$applicant->img_url = $_POST['imgvalue'];
}
$newVendor->vend_id = $_POST['vendid'];
$newVendor->vend_name = $_POST['compname'];
$newVendor->vend_contact = $_POST['contact'];
$newVendor->vend_address = $_POST['address'];
$newVendor->vend_city = $_POST['city'];
$newVendor->vend_state = $_POST['state'];
$newVendor->vend_country = $_POST['country'];
$newVendor->vend_phone = $_POST['phone'];
$newVendor->vend_email = $_POST['email'];
$newVendor->vend_website = $_POST['website'];
$newVendor->vend_accno = $_POST['accno'];
$newVendor->vend_datecreated = date("Y-m-d H:i:s");
if ($newVendor->create()) {
return 1;
//returns 1 on success
} else {
return 2;
// returns 2 on insert error
}
} else {
return 3;
//returns 3 if requiered input field is not supplied
}
}