public static function where($field, $value, $dbConn = NULL)
    {
		$table = Backbone::getTable(get_called_class(), $dbConn);

		if (is_null($dbConn)) {
			$dbConn = Backbone::makeDbConn();
		}

        try {
			$query = $dbConn->prepare('SELECT * FROM ' . $table . ' WHERE ' . $field . ' = ?');
			$query->execute([$value]);
        } catch (PDOException $e) {
            return $e->getMessage();
        } finally {
            $dbConn = null;
        }

        if ($query->rowCount()) {
            $found = new static;
            $found->dbData = $query->fetch(DbConn::FETCH_ASSOC);

            return $found;
        } else {
            throw new RecordNotFoundException;
        }
    }
public static function where($field, $value, $dbConn = NULL)
    {
		$table = Backbone::getTable(get_called_class(), $dbConn);

		if (is_null($dbConn)) {
			$dbConn = Backbone::makeDbConn();
		}

        try {
			$query = $dbConn->prepare('SELECT * FROM ' . $table . ' WHERE ' . $field . ' = ?');
			$query->execute([$value]);
        } catch (PDOException $e) {
            return $e->getMessage();
        } finally {
            $dbConn = null;
        }

        if ($query->rowCount()) {
            $found = new static;
            $found->dbData = $query->fetch(DbConn::FETCH_ASSOC);

            return $found;
        } else {
            throw new RecordNotFoundException;
        }
    }
public static function where ( $ field , $ value , $ dbConn = NULL ) { $ table = Backbone :: getTable ( get_called_class ( ) , $ dbConn ) ; if ( is_null ( $ dbConn ) ) { $ dbConn = Backbone :: makeDbConn ( ) ; } try { $ query = $ dbConn -> prepare ( 'SELECT * FROM ' . $ table . ' WHERE ' . $ field . ' = ?' ) ; $ query -> execute ( [ $ value ] ) ; } catch ( PDOException $ e ) { return $ e -> getMessage ( ) ; } finally { $ dbConn = null ; } if ( $ query -> rowCount ( ) ) { $ found = new static ; $ found -> dbData = $ query -> fetch ( DbConn :: FETCH_ASSOC ) ; return $ found ; } else { throw new RecordNotFoundException ; } }
Get a record in the database

@param string $field Field name to search under
@param string $value Field value to search for
@return string|object
Get a record in the database