Jump to content

rangersko

New Members
  • Posts

    1
  • Joined

  • Last visited

rangersko's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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() ));
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.