当前位置: 首页>>代码示例>>PHP>>正文


PHP Error::MySQL方法代码示例

本文整理汇总了PHP中Error::MySQL方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::MySQL方法的具体用法?PHP Error::MySQL怎么用?PHP Error::MySQL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Error的用法示例。


在下文中一共展示了Error::MySQL方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 function get()
 {
     $args_list = func_get_args();
     $number_to_get = (int) $args_list[0];
     $start_number = (int) $args_list[1];
     if ($number_to_get && $start_number) {
         $query = "select ID from Users order by ID asc limit {$start_number}, {$number_to_get}";
     } else {
         if ($number_to_get) {
             $query = "select ID from Users order by ID asc limit 0, {$number_to_get}";
         } else {
             if ($start_number) {
                 $query = "select ID from Users order by ID asc limit {$start_number}, 10";
             } else {
                 $query = "select ID from Users order by ID asc limit 0, 10";
             }
         }
     }
     $q = "select count(ID) as total from Users";
     $r = mysql_query($q);
     if (!$r) {
         return Error::MySQL();
     }
     $row = mysql_fetch_assoc($r);
     $this->total = $row['total'];
     $r = mysql_query($query);
     if (!$r) {
         return Error::MySQL();
     }
     $user = array();
     while ($row = mysql_fetch_assoc($r)) {
         $user[] = User::get($row['ID']);
     }
     return $user;
 }
开发者ID:pinecreativelabs,项目名称:audition,代码行数:35,代码来源:users.php

示例2: update

 function update($setting, $value)
 {
     if (!Config::isValidSetting($setting)) {
         return Error::create("Unrecognized setting: {$setting}");
     }
     $q = "delete from Config where name = '{$setting}'";
     $r = @mysql_query($q);
     if (!$r) {
         return Error::MySQL();
     }
     $q = "insert into Config (name, value) values ('{$setting}', '" . db::sanitize_to_db($value) . "')";
     $r = @mysql_query($q);
     if (!$r) {
         return Error::MySQL();
     }
     return true;
 }
开发者ID:pinecreativelabs,项目名称:audition,代码行数:17,代码来源:config.php

示例3: populateShowsArray

 function populateShowsArray($m, $y)
 {
     $db = new db();
     $mPadded = sprintf("%02d", $m);
     $q = "select DATE_FORMAT(date, '%d') as day, ID from Shows where is_active = 1 and DATE_FORMAT(date, '%m') = '{$mPadded}' and DATE_FORMAT(date, '%Y') = '{$y}' order by date asc";
     $r = mysql_query($q);
     if ($db->isError($r)) {
         return Error::MySQL();
     }
     while ($row = mysql_fetch_assoc($r)) {
         $this->showsArray[(int) $row['day']][] = Show::get($row['ID']);
     }
 }
开发者ID:pinecreativelabs,项目名称:audition,代码行数:13,代码来源:shows.php

示例4: update

 function update($postArray)
 {
     $db = new db();
     $e = new Error();
     if (User::isAdmin()) {
         $genreID = $db->sanitize_to_db($postArray['genreID']);
         if (!$this->isValidGenreID($postArray['genreID'])) {
             $e->add("Invalid genre specified");
         }
         $name = $db->sanitize_to_db($postArray['name']);
         if ($name == '' || $name == null) {
             $e->add("You must specify a name for your band.");
         }
         $managerName = $db->sanitize_to_db($postArray['managerName']);
         $address1 = $db->sanitize_to_db($postArray['address1']);
         $address2 = $db->sanitize_to_db($postArray['address2']);
         $city = $db->sanitize_to_db($postArray['city']);
         $stateProvince = $db->sanitize_to_db($postArray['stateProvince']);
         if ($stateProvince == "??") {
             $stateProvince = $db->sanitize_to_db($postArray['stateProvinceOther']);
         }
         $postalCode = $db->sanitize_to_db($postArray['postalCode']);
         $bio = $db->sanitize_to_db($postArray['bio']);
         $miscellaneous = $db->sanitize_to_db($postArray['miscellaneous']);
         $country = $db->sanitize_to_db($postArray['country']);
         $defaultStateProvince = $db->sanitize_to_db($postArray['defaultStateProvince']);
         if ($defaultStateProvince == "??") {
             $defaultStateProvince = $db->sanitize_to_db($postArray['defaultStateProvince']);
         }
         $defaultCountry = $db->sanitize_to_db($postArray['defaultCountry']);
         $defaultCity = $db->sanitize_to_db($postArray['defaultCity']);
         $description = $db->sanitize_to_db($postArray['description']);
         if ($e->hasErrors()) {
             return $e;
         }
         $q = "delete from Band_Information";
         $r = mysql_query($q);
         if (!$r) {
             return Error::MySQL();
         }
         $q = "insert into Band_Information (name, managerName, address1, address2, city, stateProvince, postalCode, bio, miscellaneous, country, defaultStateProvince, defaultCountry, defaultCity, genreID, description) ";
         $q .= "values ('{$name}', '{$managerName}', '{$address1}', '{$address2}', '{$city}', '{$stateProvince}', '{$postalCode}', '{$bio}', '{$miscellaneous}', '{$country}', '{$defaultStateProvince}', '{$defaultCountry}', '{$defaultCity}', '{$genreID}', '{$description}')";
         $r = mysql_query($q);
         // ping auditionrocks.com
         // aborted attempt at creating an audition directory
         /*
         include_class('xmlrpc');
         $xc = new xmlrpc_client("/ping/", "www.auditionrocks.com");
         $message = new xmlrpcmsg("audition.pingBack", array(
         		new xmlrpcval($_SERVER["HTTP_HOST"] . SITE_WEB_DIRECTORY, "string"),
         		new xmlrpcval($name, "string"),
         		new xmlrpcval($bio, "string"),
         		new xmlrpcval($genreID, "int"),
         		new xmlrpcval($city, "string"),
         		new xmlrpcval($stateProvince, "string"),
         		new xmlrpcval($postalCode, "string"),
         		new xmlrpcval($country, "string"))
         	);
         
         $response = $xc->send($message, 5, "POST");
         */
         if ($r) {
             return true;
         } else {
             return Error::create("An unexplained error occurred when trying to update your information.");
         }
     }
 }
开发者ID:pinecreativelabs,项目名称:audition,代码行数:68,代码来源:band_information.php

示例5: remove

 function remove()
 {
     if ($this->canEdit()) {
         $r = @mysql_query("delete from Band_News where ID = " . $this->ID);
         if (!$r) {
             return Error::MySQL();
         }
     } else {
         return Error::create('You may not remove a post that is not yours.');
     }
 }
开发者ID:pinecreativelabs,项目名称:audition,代码行数:11,代码来源:band_news.php

示例6: registerMedia

 function registerMedia($mediaType)
 {
     $type = $mediaType == 'av' ? 'av' : 'photos';
     if (User::isAdmin()) {
         if ($type == 'av' && $this->av_area_id < 1 || $type == 'photos' && $this->photo_area_id < 1) {
             $areaTitle = $type == 'av' ? "Tour Audio/Video: " : "Tour Photos: ";
             $areaIDField = $type == 'av' ? "av_area_id" : "photo_area_id";
             if ($type == 'av') {
                 $allowed_extensions = MEDIA_EXTENSIONS_ALLOWED_AV;
                 $display = "list";
             } else {
                 $allowed_extensions = MEDIA_EXTENSIONS_ALLOWED_PHOTO;
                 $display = "grid";
             }
             $ma = MediaArea::add(0, $areaTitle . $this->title, null, $allowed_extensions, $display);
             if (db::isError($ma)) {
                 return $ma;
             }
             $ma->activate();
             $q = "update Tours set {$areaIDField} = " . $ma->getID() . " where ID = {$this->ID}";
             $r = mysql_query($q);
             if (!$r) {
                 return Error::MySQL();
             } else {
                 return $r;
             }
             return $r;
         } else {
             return Error::create("A tour with an ID of {$this->ID} is already registered.");
         }
     } else {
         return Error::create('Only an admin user may authorize a tour for media.');
     }
 }
开发者ID:pinecreativelabs,项目名称:audition,代码行数:34,代码来源:tours.php

示例7: remove

 function remove()
 {
     if (User::isAdmin()) {
         $r = @mysql_query("delete from Band_Guest_Performers where ID = " . $this->ID);
         if (!$r) {
             return Error::MySQL();
         }
     } else {
         return Error::create("Only an administrator may remove guest performers.");
     }
 }
开发者ID:pinecreativelabs,项目名称:audition,代码行数:11,代码来源:band_gps.php

示例8: moveDown

 function moveDown($filterObj = null)
 {
     if ($filterObj) {
         $proceed = $filterObj->validateMediaOperation("MOVEDOWN");
         if (db::isError($proceed)) {
             return $proceed;
         }
     }
     $a = MediaArea::get($this->area_id);
     if (!db::isError($a)) {
         $a->updateDisplayOrder();
     }
     $q = "select display_order from DarkRoom_Media_to_Areas where ID = {$this->ID}";
     $r = mysql_query($q);
     if (!$r) {
         return Error::MySQL();
     }
     $row = mysql_fetch_assoc($r);
     if ($row['display_order']) {
         $this->display_order = $row['display_order'];
     }
     $newDO = $this->display_order + 1;
     $r1 = mysql_query("update DarkRoom_Media_to_Areas set display_order = {$this->display_order} where display_order = {$newDO} and area_id = {$this->area_id}");
     $r2 = mysql_query("\tupdate DarkRoom_Media_to_Areas set display_order = {$newDO} where ID = {$this->ID}");
     if ($r1 && $r2) {
         return true;
     } else {
         $e = new Error();
         $e->add(mysql_error());
         return $e;
     }
 }
开发者ID:pinecreativelabs,项目名称:audition,代码行数:32,代码来源:m2.php

示例9: add

 function add($postArray)
 {
     if (User::isAdmin()) {
         $db = new db();
         $name = $db->sanitize_to_db($postArray['name']);
         $description = $db->sanitize_to_db($postArray['description']);
         $url = $db->sanitize_to_db($postArray['url']);
         $category_id = $postArray['category_id'];
         if (!$name) {
             $name = '(untitled link)';
         }
         if (strlen($url) < 6) {
             return Error::create("Please enter a valid URL. A URL typically begins with \"http://\"");
         }
         $r = mysql_query("INSERT INTO Links (name, description, url, category_id, is_active) VALUES ('{$name}', '{$description}', '{$url}', '{$category_id}', " . DEFAULT_ACTIVE . ")");
         if ($r) {
             $nl = Link::get(mysql_insert_id());
             return $nl;
         } else {
             return Error::MySQL();
         }
     } else {
         return Error::create("Only an administrator may add links.");
     }
 }
开发者ID:pinecreativelabs,项目名称:audition,代码行数:25,代码来源:links.php

示例10: add

 function add($postArray)
 {
     $db = new db();
     $uo = User::getCurrent();
     if (User::isAdmin()) {
         $uo = User::get($postArray['user_id']);
         if (db::isError($uo)) {
             $e->add($uo);
         } else {
             if (!$uo->isAdmin() && $uo->isBandMember()) {
                 $e->add("Invalid user. User must be a band member or an administrator.");
             }
         }
     } else {
         $uo = User::getCurrent();
     }
     $user_id = $uo->getID();
     $name = $db->sanitize_to_db($postArray['name']);
     $address1 = $db->sanitize_to_db($postArray['address1']);
     $address2 = $db->sanitize_to_db($postArray['address2']);
     $city = $db->sanitize_to_db($postArray['city']);
     $stateProvince = $db->sanitize_to_db($postArray['stateProvince']);
     if ($stateProvince == "??") {
         $stateProvince = $db->sanitize_to_db($postArray['stateProvinceOther']);
     }
     $postalCode = $db->sanitize_to_db($postArray['postalCode']);
     $directions = $db->sanitize_to_db($postArray['directions']);
     $country = $db->sanitize_to_db($postArray['country']);
     $country = $country == null ? VENUE_DEFAULT_COUNTRY : $country;
     if (!$name) {
         $name = '(untitled venue)';
     }
     $r = mysql_query("insert into Venues (user_id, country, name, address1, address2, city, stateProvince, postalCode, directions, is_active) values ('{$user_id}', '{$country}', '{$name}', '{$address1}', '{$address2}', '{$city}', '{$stateProvince}', '{$postalCode}', '{$directions}'," . DEFAULT_ACTIVE . ")");
     if ($r) {
         return Venue::get(mysql_insert_id());
     } else {
         return Error::MySQL();
     }
 }
开发者ID:pinecreativelabs,项目名称:audition,代码行数:39,代码来源:venues.php

示例11: getMemberPhoto

 function getMemberPhoto()
 {
     // the album cover is actually the first piece of media that's active in a given member's media area
     // first we get the media area ID for the given release.
     if ($this->photo_area_id) {
         // if we have an area ID, we continue
         $q = "select ID from DarkRoom_Media_to_Areas where area_id = {$this->photo_area_id} and is_active = 1 order by display_order asc limit 1";
         $r = mysql_query($q);
         if (!$r) {
             return Error::MySQL();
         }
         $row = mysql_fetch_assoc($r);
         if ($row['ID']) {
             $mi = MediaInstance::get($row['ID']);
             return $mi;
         }
     }
 }
开发者ID:pinecreativelabs,项目名称:audition,代码行数:18,代码来源:band_members.php

示例12: registerMedia

 function registerMedia()
 {
     if (User::isAdmin()) {
         if ($this->av_area_id < 1) {
             $areaTitle = "Track Audio/Video: ";
             $allowed_extensions = MEDIA_EXTENSIONS_ALLOWED_AV;
             $display = "list";
             $ma = MediaArea::add(0, $areaTitle . $this->title, null, $allowed_extensions, $display);
             if (db::isError($ma)) {
                 return $ma;
             }
             $ma->activate();
             $q = "update Release_Tracks set av_area_id = " . $ma->getID() . " where ID = {$this->ID}";
             $r = mysql_query($q);
             if (!$r) {
                 return Error::MySQL();
             } else {
                 return $r;
             }
             return $r;
         } else {
             return Error::create("A track with an ID of {$this->ID} is already registered.");
         }
     } else {
         return Error::create('Only an admin user may authorize a track for media.');
     }
 }
开发者ID:pinecreativelabs,项目名称:audition,代码行数:27,代码来源:release_tracks.php


注:本文中的Error::MySQL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。