public static function getConnection() { if (self::$mysqliConnection) { return self::$mysqliConnection; } else { self::$mysqliConnection = new mysqli(self::host, self::user, self::password, self::database); if (!self::$mysqliConnection) { die("Could not connect to the database"); } else { return self::$mysqliConnection; } } }
public static function selectRowsByKeywords($condition, $keywords) { $queryCondition = " WHERE {$condition}"; $query = "SELECT *,(MATCH (`job_title`,`job_description`) AGAINST ('{$keywords}')) as `relevance` FROM " . static::tableName() . "{$queryCondition};"; return MysqliConnection::getConnection()->query($query); }
protected static function fieldSearch($fieldValue, $fieldName) { $query = "SELECT * FROM " . static::tableName() . " WHERE {$fieldName} = {$fieldValue}"; return MysqliConnection::getConnection()->query($query); }