Function __global->add_poll

Definitions

sources/polls2.php

  • Add a new poll to the database, then return the ID of the new entry.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: int

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$question SHORT_TEXT No No required parameter N/A N/A The question
$a1 SHORT_TEXT No No required parameter N/A 1 max The first choice
$a2 SHORT_TEXT No No required parameter N/A 1 max The second choice
$a3 SHORT_TEXT No No Blank (empty string) N/A N/A The third choice (blank means not a choice)
$a4 SHORT_TEXT No No Blank (empty string) N/A N/A The fourth choice (blank means not a choice)
$a5 SHORT_TEXT No No Blank (empty string) N/A N/A The fifth choice (blank means not a choice)
$a6 SHORT_TEXT No No Blank (empty string) N/A N/A The sixth choice (blank means not a choice)
$a7 SHORT_TEXT No No Blank (empty string) N/A N/A The seventh choice (blank means not a choice)
$a8 SHORT_TEXT No No Blank (empty string) N/A N/A The eighth choice (blank means not a choice)
$a9 SHORT_TEXT No No Blank (empty string) N/A N/A The ninth choice (blank means not a choice)
$a10 SHORT_TEXT No No Blank (empty string) N/A N/A The tenth choice (blank means not a choice)
$num_options ?integer No No Null N/A 2 5 The number of choices (null: calculate)
$current BINARY No No 0 N/A N/A Whether the poll is the current poll
$allow_rating BINARY No No 1 N/A N/A Whether to allow rating of this poll
$allow_comments SHORT_INTEGER No No 1 N/A N/A Whether comments are allowed (0=no, 1=yes, 2=review style)
$allow_trackbacks BINARY No No 1 N/A N/A Whether to allow trackbacking on this poll
$notes LONG_TEXT No No Blank (empty string) N/A N/A Notes about this poll
$time ?TIME No No Null N/A N/A The time the poll was submitted (null: now)
$submitter ?MEMBER No No Null N/A N/A The member who submitted (null: the current member)
$use_time ?TIME No No Null N/A N/A The time the poll was put to use (null: not put to use yet)
$v1 integer No No 0 N/A 0 max How many have voted for option 1
$v2 integer No No 0 N/A 0 max How many have voted for option 2
$v3 integer No No 0 N/A 0 max How many have voted for option 3
$v4 integer No No 0 N/A 0 max How many have voted for option 4
$v5 integer No No 0 N/A 0 max How many have voted for option 5

Returns

  • The poll ID of our new poll
  • Type: AUTO_LINK
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Add a new poll to the database, then return the ID of the new entry.
 *
 * @param  SHORT_TEXT $question The question
 * @param  SHORT_TEXT $a1 The first choice
 * @range 1 max
 * @param  SHORT_TEXT $a2 The second choice
 * @range 1 max
 * @param  SHORT_TEXT $a3 The third choice (blank means not a choice)
 * @param  SHORT_TEXT $a4 The fourth choice (blank means not a choice)
 * @param  SHORT_TEXT $a5 The fifth choice (blank means not a choice)
 * @param  SHORT_TEXT $a6 The sixth choice (blank means not a choice)
 * @param  SHORT_TEXT $a7 The seventh choice (blank means not a choice)
 * @param  SHORT_TEXT $a8 The eighth choice (blank means not a choice)
 * @param  SHORT_TEXT $a9 The ninth choice (blank means not a choice)
 * @param  SHORT_TEXT $a10 The tenth choice (blank means not a choice)
 * @param  ?integer $num_options The number of choices (null: calculate)
 * @range 2 5
 * @param  BINARY $current Whether the poll is the current poll
 * @param  BINARY $allow_rating Whether to allow rating of this poll
 * @param  SHORT_INTEGER $allow_comments Whether comments are allowed (0=no, 1=yes, 2=review style)
 * @param  BINARY $allow_trackbacks Whether to allow trackbacking on this poll
 * @param  LONG_TEXT $notes Notes about this poll
 * @param  ?TIME $time The time the poll was submitted (null: now)
 * @param  ?MEMBER $submitter The member who submitted (null: the current member)
 * @param  ?TIME $use_time The time the poll was put to use (null: not put to use yet)
 * @param  integer $v1 How many have voted for option 1
 * @range 0 max
 * @param  integer $v2 How many have voted for option 2
 * @range 0 max
 * @param  integer $v3 How many have voted for option 3
 * @range 0 max
 * @param  integer $v4 How many have voted for option 4
 * @range 0 max
 * @param  integer $v5 How many have voted for option 5
 * @range 0 max
 * @return AUTO_LINK The poll ID of our new poll
 */

function add_poll(string $question, string $a1, string $a2, string $a3 = '', string $a4 = '', string $a5 = '', string $a6 = '', string $a7 = '', string $a8 = '', string $a9 = '', string $a10 = '', ?int $num_options = null, int $current = 0, int $allow_rating = 1, int $allow_comments = 1, int $allow_trackbacks = 1, string $notes = '', ?int $time = null, ?int $submitter = null, ?int $use_time = null, int $v1 = 0, int $v2 = 0, int $v3 = 0, int $v4 = 0, int $v5 = 0) : int