creating answer set doesn't work

Permalink Browser Info Environment
sixeightAnswerSet::create() is broken. The problem is in this part of the method:

$db->execute("INSERT INTO sixeightformsAnswerSets (asID,fID,dateSubmitted,dateUpdated,ipAddress,creator,editCode,amountCharged,isApproved,cID,recordID) VALUES (0,?,?,?,?,?,?,?,?,?,?)",array($fID,$timestamp,time(),$ipAddress,$uID,$editCode,$totalPrice,$approvalStatus,$cID,$recordID));
if($recordID == 0) {
$db->execute("UPDATE sixeightformsAnswerSets SET recordID = ? WHERE asID = ?",array($db->Insert_ID(),$db->Insert_ID()));
}

$as = sixeightAnswerSet::getByID($db->Insert_ID(),0,$getAnswers);

return $as;

After the UPDATE sql statement $db->Insert_ID() no longer returns a value. It appears that UPDATE resets it. The fix is to record $db->Insert_ID() into it's own variable after the insert and pass that into sixeightAnswerSet::getByID() instead of passing $db->Insert_ID()

Type: Discussion
Status: New
circ
View Replies:

concrete5 Environment Information

# concrete5 Version
5.6.3.4

# concrete5 Packages
Advanced Forms (1.13.2), Advertisement (1.6.2.1), BankDirector (0.1.6.103), Conference Schedule (0.1.32), Constant Contact (0.1), Core Commerce Pricing Tier Discount Type (0.1), eCommerce (2.8.16), Force SSL (1.0), Sortable Fancybox Gallery (1.13), Static Pages (0.4).

# concrete5 Overrides
blocks/content, blocks/external_form, blocks/html, blocks/page_list, helpers/mail.php, mail/forgot_password.php, models/attribute, single_pages/checkout, single_pages/login.php, tools/test

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - Off
Full Page Caching - Off

# Server Software
Apache/2.2.22 (Ubuntu)

# Server API
apache2handler

# PHP Version
5.3.10-1ubuntu3.19

# PHP Extensions
apache2handler, apc, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, json, libxml, mbstring, mcrypt, mhash, mysql, mysqli, openssl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, Reflection, session, shmop, SimpleXML, soap, sockets, SPL, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xdebug, xml, xmlreader, xmlwriter, zip, zlib.

# PHP Settings
max_execution_time - 30
apc.max_file_size - 1M
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 128M
post_max_size - 8M
safe_mode - Off
safe_mode_exec_dir - <i>no value</i>
safe_mode_gid - Off
safe_mode_include_dir - <i>no value</i>
sql.safe_mode - Off
upload_max_filesize - 2M
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - nocache
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
safe_mode_allowed_env_vars - PHP_
safe_mode_protected_env_vars - LD_LIBRARY_PATH
xdebug.max_nesting_level - 100
xdebug.var_display_max_children - 128
xdebug.var_display_max_data - 512
xdebug.var_display_max_depth - 3

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.