Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

PHP cms via phpacademy

$
0
0

OK i am trying to add a posters id/username onto my mysql database. I added a table and 
i am making a progress but the only part i am stuck on is the php side... I get no more errors when i create the article but it doesnt post onto mysql, it just refreshes the page kinda thing.

In artictles.php in templates
<textarea cols="40" rows="1" name="postid" disabled="disabled"><?php echo $user->username(); ?></textarea><br />


In articles.php in admin
if (isset($_POST['title'], $_POST['content'], $_POST['postid'])) {
        $title = $_POST['title'];
        $content = $_POST['content'];
        $postid = $_POST['postid'];

if (!isset($error)) {
            $article->add($title, $content, $postid);

 
I think this part is the wrong part
public function add($title, $content, $postid) {
        global $pdo;

        $query = $pdo->prepare('INSERT INTO articles (article_title, article_content, artictle_postid ,article_timestamp) VALUES (?, ?, ?, ?)');

        return $query->execute(array(
            $title,
            $content,
            $postid,
            time()
        ));

Viewing all articles
Browse latest Browse all 13200

Trending Articles