function addQuestions($quizId, $sectionId, $count) { $questionQuery = "INSERT INTO `quiz_questions`(`page_modulecomponentid`, `quiz_sectionid`, `quiz_question`, `quiz_questiontype`, `quiz_questionrank`, `quiz_questionweight`, `quiz_answermaxlength`, `quiz_rightanswer`) " . "(SELECT '{$quizId}','{$sectionId}', 'Your new question here?', 'subjective', IFNULL(MAX(`quiz_questionrank`), 0) + 1, 1, 1024, 'Yes, it sure is.' FROM `quiz_questions` WHERE `page_modulecomponentid` = '{$quizId}' AND `quiz_sectionid` = '{$sectionId}' LIMIT 1)"; return addItems($questionQuery, $count); }
function updateSite($siteData) { global $db; print "\nUpdate " . $siteData["url"] . "\n"; if (strlen(trim($siteData["keyname"])) == 0) { print "Parser not defined.\n"; return; } $parserName = $siteData["keyname"] . "ContentGrabber"; include_once "parsers/{$parserName}.php"; if (!class_exists($parserName)) { print "Parser not found.\n"; return; } $parser =& new $parserName(); $res =& $db->query(CMD_SEL_SITECATEGORY, array($siteData["id"])); if (PEAR::isError($res)) { print $res->getMessage() . "\n"; return; } while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { print $row->url . "\n"; $parseRes = $parser->parseFromUrl($row->url); if (PEAR::isError($parseRes)) { print $parseRes->getMessage() . "\n"; continue; } addItems($row, $parser->items); } }
<?php include "functions.php"; $data = $_POST["data"]; $param = explode(".", $data); $projId = $param[0]; $subId = $param[1]; $s_digOfSpec = $_POST["s_digOfSpec"]; $s_Qty = $_POST["s_Qty"]; $s_Unit = $_POST["s_Unit"]; $s_Um = $_POST["s_Um"]; // $s_M = $_POST["s_M"]; $s_Ul = $_POST["s_Ul"]; $s_Amount2 = $_POST["s_Amount2"]; $s_M = $s_Qty * $s_Um; $s_L = $s_Qty * $s_Ul; $s_Amount1 = $s_M * $s_L; // $main = "Sample"; addItems($projId, $subId, $s_digOfSpec, $s_Qty, $s_Unit, $s_Um, $s_M, $s_Ul, $s_L, $s_Amount1, $s_Amount2); echo jsonify($response);