本文整理匯總了PHP中sql::getvalue方法的典型用法代碼示例。如果您正苦於以下問題:PHP sql::getvalue方法的具體用法?PHP sql::getvalue怎麽用?PHP sql::getvalue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sql
的用法示例。
在下文中一共展示了sql::getvalue方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: rex_copyContent
/**
* Kopiert die Inhalte eines Artikels in einen anderen Artikel
*
* @param $from_id ArtikelId des Artikels, aus dem kopiert werden (Quell ArtikelId)
* @param $to_id ArtikelId des Artikel, in den kopiert werden sollen (Ziel ArtikelId)
* @param [$from_clang] ClangId des Artikels, aus dem kopiert werden soll (Quell ClangId)
* @param [$to_clang] ClangId des Artikels, in den kopiert werden soll (Ziel ClangId)
* @param [$from_re_sliceid] Id des Slices, bei dem begonnen werden soll
*/
function rex_copyContent($from_id, $to_id, $from_clang = 0, $to_clang = 0, $from_re_sliceid = 0)
{
global $REX, $REX_USER;
if ($from_id == $to_id && $from_clang == $to_clang) {
return false;
}
$gc = new sql();
$gc->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article_slice where re_article_slice_id='{$from_re_sliceid}' and article_id='{$from_id}' and clang='{$from_clang}'");
if ($gc->getRows() == 1) {
// letzt slice_id des ziels holen ..
$glid = new sql();
$glid->setQuery("select r1.id, r1.re_article_slice_id\r\n from " . $REX['TABLE_PREFIX'] . "article_slice as r1 \r\n left join " . $REX['TABLE_PREFIX'] . "article_slice as r2 on r1.id=r2.re_article_slice_id \r\n where r1.article_id={$to_id} and r1.clang={$to_clang} and r2.id is NULL;");
if ($glid->getRows() == 1) {
$to_last_slice_id = $glid->getValue("r1.id");
} else {
$to_last_slice_id = 0;
}
$ins = new sql();
// $ins->debugsql = 1;
$ins->setTable($REX['TABLE_PREFIX'] . "article_slice");
$cols = new sql();
// $cols->debugsql = 1;
$cols->setquery("SHOW COLUMNS FROM " . $REX['TABLE_PREFIX'] . "article_slice");
for ($j = 0; $j < $cols->rows; $j++, $cols->next()) {
$colname = $cols->getvalue("Field");
if ($colname == "clang") {
$value = $to_clang;
} elseif ($colname == "re_article_slice_id") {
$value = $to_last_slice_id;
} elseif ($colname == "article_id") {
$value = $to_id;
} elseif ($colname == "createdate") {
$value = time();
} elseif ($colname == "updatedate") {
$value = time();
} elseif ($colname == "createuser") {
$value = $REX_USER->getValue("login");
} elseif ($colname == "updateuser") {
$value = $REX_USER->getValue("login");
} else {
$value = addslashes($gc->getValue("{$colname}"));
}
if ($colname != "id") {
$ins->setValue($colname, $value);
}
}
$ins->insert();
// id holen und als re setzen und weitermachen..
rex_copyContent($from_id, $to_id, $from_clang, $to_clang, $gc->getValue("id"));
return true;
}
rex_generateArticle($to_id);
return true;
}
示例2: current
$query .= current($key);
if ($k + 1 != count($key)) {
$query .= ",";
}
}
$query .= ")";
}
$query .= ")TYPE=MyISAM;";
$dump .= $query . "\n";
$cont = new sql();
$cont->setquery("SELECT * FROM " . $tabs->getvalue("Tables_in_" . $DB[1][NAME]));
for ($j = 0; $j < $cont->rows; $j++, $cont->next()) {
$query = "INSERT INTO " . $tabs->getvalue("Tables_in_" . $DB[1][NAME]) . " VALUES (";
$cols->counter = 0;
for ($k = 0; $k < $cols->rows; $k++, $cols->next()) {
if (is_numeric($cont->getvalue($cols->getvalue("Field")))) {
$query .= "'" . $cont->getvalue($cols->getvalue("Field")) . "'";
} else {
$query .= "'" . addslashes($cont->getvalue($cols->getvalue("Field"))) . "'";
}
if ($k + 1 != $cols->rows) {
$query .= ",";
}
}
$query .= ");";
$dump .= str_replace("\n", "||||||+N+||||||", $query) . "\n";
// <<<---- schrecklich aber zweckmäßig --- workaround??
}
// end for für content der tabelle
}
// end else für rex_user tabelle rausnehmen
示例3: current
$query .= current($key);
if ($k + 1 != count($key)) {
$query .= ",";
}
}
$query .= ")";
}
$query .= ")TYPE=MyISAM;";
$dump .= $query . "\n";
$cont = new sql();
$cont->setquery("SELECT * FROM " . $tab);
for ($j = 0; $j < $cont->rows; $j++, $cont->next()) {
$query = "INSERT INTO " . $tab . " VALUES (";
$cols->counter = 0;
for ($k = 0; $k < $cols->rows; $k++, $cols->next()) {
$con = $cont->getvalue($cols->getvalue("Field"));
if (is_numeric($con)) {
$query .= "'" . $con . "'";
} else {
$query .= "'" . addslashes($con) . "'";
}
if ($k + 1 != $cols->rows) {
$query .= ",";
}
}
$query .= ");";
$dump .= str_replace(array("\r\n", "\n"), '\\r\\n', $query) . "\n";
}
}
}
$content = "## Redaxo Database Dump Version " . $REX[version] . " \n" . str_replace("\r", "", $dump);
示例4: fopen
$err_msg = $I18N->msg("no_import_file_chosen_or_wrong_version") . "<br>";
} else {
$file_temp = $REX[INCLUDE_PATH] . "/install/temp.sql";
if (@move_uploaded_file($_FILES['FORM']['tmp_name']['importfile'], $file_temp)) {
$h = fopen($file_temp, "r");
$conts = fread($h, filesize($file_temp));
if (!ereg("## Redaxo Database Dump Version " . $REX[version] . " \n", $conts)) {
$err_msg = $I18N->msg("no_valid_import_file") . ".<br>";
} else {
$conts = str_replace("## Redaxo Database Dump Version " . $REX[version] . " \n", "", $conts);
$all = explode("\n", $conts);
$tabs = new sql();
$tabs->setquery("SHOW TABLES");
$del = new sql();
for ($i = 0; $i < $tabs->rows; $i++, $tabs->next(), $del->flush()) {
if ($tabs->getvalue("Tables_in_" . $DB[1][NAME]) != "rex_user") {
$del->setquery("DROP TABLE " . $tabs->getvalue("Tables_in_" . $DB[1][NAME]));
}
}
$add = new sql();
foreach ($all as $hier) {
$add->setquery(Trim(str_replace("||||||+N+||||||", "\n", $hier), ";"));
$add->flush();
}
$err_msg = $I18N->msg("database_imported") . ". " . $I18N->msg("entry_count", count($all)) . " | " . $I18N->msg("go_to_special_features") . ".<br>";
@unlink($file_temp);
}
} else {
$err_msg = $I18N->msg("file_could_not_be_uploaded") . " " . $I18N->msg("you_have_no_write_permission_in", "include/install") . " " . $I18N->msg("check_install_php") . "<br>";
}
}