示例#1
0
function update_action()
{
    update_row();
    $rows = get_all_rows();
    $html = render_template("view/admin.php", array('rows' => $rows));
    return $html;
}
示例#2
0
function add_action()
{
    add_row();
    //$row=
    $sql = "SELECT * FROM pages ORDER BY id DESC";
    $rows = get_all_rows($sql);
    $html = render_template("View/admin.php", array('rows' => $rows));
    return $html;
    //require "View/admin.php";
}
示例#3
0
文件: index.php 项目: bambr325/mySite
<?php

include "model.php";
$rows = get_all_rows();
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Индексная страница (front controller)</title>
</head>
<body>
	<h1>Список всех записей в таблице</h1>
		<ol>

			<li>
				<?php 
echo $rows['title'] . '<br>' . $rows['text'];
?>
			</li>
		</ol>
</body>
</html>
示例#4
0
    $query = " UPDATE forums";
    $query .= " SET locked='{$lock}' ";
    $query .= " WHERE forum_id='{$forum_id}' ";
    $result = mysql_query($query, $connection);
    if (!$result) {
        die("Error executing query: " . mysql_error());
    }
    close_connection($connection);
    redirect_to("index_.php");
}
//create new section
if ($_POST['submit'] == "Create" && $_POST['action'] == "create_section") {
    connect_to_database();
    select_database();
    $name = mysql_prep($_POST['section_name']);
    $position = get_all_rows("sections") + 1;
    if (strlen($name) > 20) {
        $errors[] = "Character limit for Section Name is 20";
    }
    if ($name == "") {
        $errors[] = "Name cannot be empty.";
    }
    if (empty($errors)) {
        $query = " INSERT INTO sections";
        $query .= " (section_name, position) ";
        $query .= " VALUES ('{$name}', '{$position} ') ";
        $result = mysql_query($query, $connection);
        if (!$result) {
            die("Error executing query: " . mysql_error());
        } else {
            close_connection($connection);
echo $section['section_id'];
?>
">
						<input type="hidden" name="action" value="update_section_name">
						<input type="submit" name="submit" value="Update" class="button">		
					</td>
				</tr>
				</form>

				<form method="post" action="validation.php">
				<tr>
					<td>Change Position</td>
					<td>
						<select name="new_position" class="text">
							<?php 
$section_num = get_all_rows("sections");
for ($i = 1; $i <= $section_num; $i++) {
    echo "<option value=\"{$i}\" ";
    if ($i == $section['position']) {
        echo "selected";
    }
    echo "> {$i} </option>";
}
?>
						</select>
					</td>
					<td>
						<input type="hidden" name="action" value="update_section_position">
						<input type="hidden" name="section_id" value="<?php 
echo $section['section_id'];
?>