本文整理匯總了PHP中Source::Insert方法的典型用法代碼示例。如果您正苦於以下問題:PHP Source::Insert方法的具體用法?PHP Source::Insert怎麽用?PHP Source::Insert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Source
的用法示例。
在下文中一共展示了Source::Insert方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Source
<?
require('../include/config.php');
require('../include/class.source.php');
$n = new Source($db);
$source = $_POST['source'];
$s = $n->getSource($source);
if (!isset($s['source_id'])) {
$n->Insert(Array(
'source_id' => $source,
'source_name' => $source,
'type' => 'good'
));
} else {
var_dump($n->setType(Array(
'type' => 'good',
'source_id' => $source
)));
}
?>
示例2: Source
<?php
if (isset($_POST['submit'])) {
require 'include/config.php';
require 'include/class.source.php';
$n = new Source($db);
$n->Insert($_POST);
if ($_POST['type'] != 'bad') {
Misc::Redirect('sources_list.php');
} else {
Misc::Redirect('badsources_list.php');
}
}
include 'include/top.php';
?>
<form method="post">
<p>
<label><span>Source ID</span></label>
<input type="text" name="source_id" id="source_id" placeholder="Enter source ID" />
</p>
<p>
<label><span>Source name</span></label>
<input type="text" name="source_name" id="source_name" placeholder="Enter source name" />
</p>
<p>
<label><span>Source type</span></label>
Good <input type="radio" name="type" value="good" checked="checked" /> <input type="radio" name="type" value="bad" /> Bad
</p>
<p>
<input type="submit" name="submit" value=" Add " />