Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
?>
<?php
include "db.php";
$id = $_POST["pageid"];
$title = $_POST["pagetitle"];
$content = $_POST["pagecontent"];
$image = $_POST["pageimage"];
//mysqli_query($connect"INSERT INTO site ('id', 'title', 'content') VALUES ($id, $title, $content)");
//$myPDO = new PDO('mysql:host=localhost;dbname=babycms', 'root', 'root');
if (isset($_POST["submit"])){
//$myPDO->query("INSERT INTO site ('id', 'title', 'content') VALUES ($id, $title, $content)");
//mysqli_query($connect"INSERT INTO site ('id', 'title', 'content') VALUES ($id, $title, $content)");
// this means we're updating an existing page...because the id isn't nada
if($id) {
$query = "UPDATE pages SET title = '$title', content = '$content', image = '$image' WHERE id = ". $id;
$result = $connect->query($query);
echo "<a href='page.php?id=". $id . "'/>";
echo "View Page";
echo "</a>";
} else {
$query = "INSERT INTO pages (id, title, content, img) VALUES (NULL, '$title', '$content', '$image')";
//echo $query;
$insert = $connect->query($query);
if($insert){
echo "<a href='page.php?id=". $id . "'/>";
echo "view page";
echo "</a>";
}
}
}
?>