rangersko Posted August 1, 2013 Share Posted August 1, 2013 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 adminif (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 partpublic 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() )); Quote Link to comment https://forums.phpfreaks.com/topic/280726-php-cms-via-phpacademy/ Share on other sites More sharing options...
lemmin Posted August 1, 2013 Share Posted August 1, 2013 More code would be helpful in solving this. I'm guessing you ARE getting errors, but aren't seeing them. Can you check your error_logs? If you actually aren't getting any errors and nothing is being inserted into that table, then the add() function isn't executing, meaning the $error variable is probably set. Remember, a variable can be empty, but still "set." Quote Link to comment https://forums.phpfreaks.com/topic/280726-php-cms-via-phpacademy/#findComment-1443018 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.