Hello all,
I have a little problem updating my sql.
This is my page:
<?php
session_start();
include_once('../includes/connection.php');
include_once('../includes/article.php');
$article = new Article;
if (isset($_SESSION['logged_in'])) {
if (isset($_GET['id'])) {
$id = $_GET['id'];
$query = $pdo->prepare('SELECT FROM articles WHERE article_id =?');
$query->bindValue(1, $id);
$query->execute();
header('Location: edit.php');
}
$articles = $article->fetch_all();
?>
<html>
<head>
</head>
<body>
<h4>Edit Article</h4>
<?php if (isset($error)) { ?>
<small style="color:#aa0000"><?php echo $error; ?>
<?php } ?>
<form action="edit.php" method="post">
<?php foreach ($articles as $article) { ?>
ID: <input type="text" name="id" value="<?php echo $article['article_id']; ?>"><br /><br />
Article Title: <b><?php echo $article['article_title']; ?></b> <br /><br />
Text: <br/> <textarea rows="15" name="article_content" cols="50"><?php echo $article['article_content']; ?></textarea><br /><br />
<input type="submit" value="Edit Article"> <br/ >
<?php }
if( isset($_POST['article_content']))
{
$newcontent = $_POST['article_content'];
$id = $_POST['id'];
$query = $pdo->query("UPDATE article_content SET article_content='$newcontent' WHERE id='$id'");
}
?>
</form>
<a href="index.php">← Back</a>
</body>
</html>
<?php
} else {
header('Location: index.php');
}
?>
Here is a screen of my database: http://imageshack.us...ing2013021.png/
Could somebody please help me?
-edit-
Its about the article_content row.
That has to be updated.
Thnx