case 'projpost': $text = $_POST['text']; $title = $_POST['title']; if ($id == 'add') { mysql_query("INSERT INTO " . $db_prefix . "projects\n (title, text)\n VALUES ('{$title}', '{$text}')", $con); $id = mysql_insert_id($con); $add = true; } else { mysql_query("UPDATE " . $db_prefix . "projects\n SET title='{$title}', text='{$text}'\n WHERE id={$id}", $con); } $result = mysql_query("SELECT * FROM " . $db_prefix . "projects WHERE id={$id}", $con); while ($row = mysql_fetch_array($result)) { if ($add) { echo "<li id=\"proj{$id}\">"; } formatProject($row); if ($add) { echo "</li>"; } } break; case 'projdel': mysql_query("DELETE FROM " . $db_prefix . "projects WHERE id={$id}"); echo "<i>Project Removed</i>"; break; case 'memform': if ($id == 'add') { $row = array(); } else { $result = mysql_query("SELECT * FROM " . $db_prefix . "members WHERE id={$id} ORDER BY id", $con); $row = mysql_fetch_array($result);
function adminProjects() { global $con; global $db_prefix; sqlcon(); ?> <h2>Projects</h2> <ul id="projlist"><?php $result = mysql_query("SELECT * FROM " . $db_prefix . "projects", $con); while ($row = mysql_fetch_array($result)) { echo "<li id=\"proj" . $row['id'] . "\">"; formatProject($row); echo "</li>\n"; } ?> </ul> <div id="projadd"><button type="button" onClick="editProj('add')">Add New Project</button></div> <?php }