本文整理汇总了PHP中Club::clubnameExists方法的典型用法代码示例。如果您正苦于以下问题:PHP Club::clubnameExists方法的具体用法?PHP Club::clubnameExists怎么用?PHP Club::clubnameExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Club
的用法示例。
在下文中一共展示了Club::clubnameExists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
static function add($username, $passwordRaw, $type, $name, $age, $club)
{
//
$db = new DB();
$usernameAvailable = User::usernameExists($username);
$clubnameAvailable = Club::clubnameExists($club);
$password = hash('md5', $passwordRaw);
if ($usernameAvailable == FALSE) {
$res = $db->queryIns("INSERT INTO user(username,password,type) VALUES('{$username}','{$password}','{$type}')");
$u_id = $db->query("SELECT user_id FROM user WHERE username='{$username}'")->fetch(PDO::FETCH_ASSOC);
//->fetch(PDO::FETCH_ASSOC)
$c_id = $db->query("SELECT club_id FROM club WHERE name = '{$club}'")->fetch(PDO::FETCH_ASSOC);
$user_id = (int) $u_id['user_id'];
$club_id = (int) $c_id['club_id'];
$agein = (int) $age;
var_dump($clubnameAvailable);
if ($type == "player" and $clubnameAvailable == TRUE) {
$res = $db->queryIns("INSERT INTO player (player_id,club_id,name,age) VALUES ({$user_id},{$club_id},'{$name}',{$agein})");
//
}
if ($type = "manager") {
$res = $db->queryIns("INSERT INTO manager (manager_id,name,age) VALUES ({$user_id},'{$name}',{$agein})");
// this is ok.
$result = $db->query("INSERT INTO club (manager_id,name) VALUES ({$user_id},'{$club}')");
var_dump($name);
}
} else {
echo 0;
}
}
示例2: addClub
static function addClub($clubname, $managerName)
{
$db = new DB();
var_dump($clubname);
var_dump($managerName);
$clubNameAvailable = Club::clubnameExists($clubname);
//var_dump($clubNameAvailable);echo "<br>";
$m_id = $db->query("SELECT user_id FROM user WHERE username='{$managerName}' AND type='manager'")->fetch(PDO::FETCH_ASSOC);
//var_dump($m_id);echo "<br>";
$manager_id = (int) $m_id["user_id"];
var_dump($manager_id);
if ($clubNameAvailable == FALSE) {
// if club name is not available then can add as the manager.
$res = $db->queryIns("INSERT INTO club (manager_id,name) VALUES ({$manager_id},'{$clubname}')");
}
var_dump($res);
}
示例3: filter_input
<?php
require_once './utilities/Club.class.php';
$club = filter_input(INPUT_POST, 'club');
$club = $_GET['club'];
echo Club::clubnameExists($club);