Jump to content

DonkeyKong

Members
  • Posts

    6
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

DonkeyKong's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. God, you are petulant; I was just trying to discuss your hint, obviously I'd like to understand what you are giving me, but sure
  2. mmm a hideen input ? mmm you are aware Im calling this from a differen php file correct ?
  3. it is yesh : <?php require('cunnect.php'); $query = "SELECT title, content FROM nothingmovestheblog WHERE id = {$_GET['id']} "; $result = $db->query($query); $row = $result->fetch_assoc(); ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title> Blog </title> <link rel=stylesheet type=text/css href=style.css /> </head> <body> <div id="wrapper"> <div id="header"> <h1> <a href="index.php">My Terrible Awful Blog - New Post</a> </h1> </div> <ul id="menu"> <li> <a href="index.php">Home</a> </li> <li> <a href="archive.php">Archive</a> </li> <li> <a href="create.php" class="active">New Post</a> </li> </ul> <div id="theblogs"> <?php if (isset($_POST)) { if (!empty($_POST['submit'])) { $title = $_POST['title']; $content = $_POST['content']; $query = ("UPDATE nothingmovestheblog SET title = '$title', content = '$content' WHERE id= {$_GET['id']}"); $results = $db->query($query); header('Location: index.php'); }else{ ?> <form action = "update.php" method = "post"> <fieldset> <p> <legend>Edit Your Post</legend> <label for= "title">Title</label> <input name = "title" id = "title" value = <?php echo $row['title']?> /> </p> <p> <label for= "content">Content</label> <textarea id="content" name="content" rows="5" required><?php echo $row['content']?></textarea> </p> <p> <input type = "submit" name = "submit" value = "I'd Like To Fix This Post !"/> </p> </fieldset> </form> <?php } } ?> </div> <div id = "footer">CopyClown - No Rights To Reserve</div> </div> </body> </html>
  4. Don't get me wrong I'm sure you are the nicest person around here , in fact you deserve a price for being concerned of a noobie I was just kindly answering your statement. at any case the part I think if my code is relevant would be : <div id="theblogs"> <?php if (isset($_POST)) { if (!empty($_POST['submit'])) { $title = $_POST['title']; $content = $_POST['content']; $query = ("UPDATE nothingmovestheblog SET title = '$title', content = '$content' WHERE id= {$_GET['id']}"); $results = $db->query($query); header('Location: index.php'); }else{ ?> <form action = "update.php" method = "post"> <fieldset> <p> <legend>Edit Your Post</legend> <label for= "title">Title</label> <input name = "title" id = "title" value = <?php echo $row['title']?> /> </p> <p> <label for= "content">Content</label> <textarea id="content" name="content" rows="5" required><?php echo $row['content']?></textarea> </p> <p> <input type = "submit" name = "submit" value = "I'd Like To Fix This Post !"/> </p> </fieldset> </form> <?php } } ?> I have a query there that works on MyPHPadmin Im running a table on a database so far on my other php files, Im able to write Into the database(post new blogs) and read from it but when i select an update on an actual post to run the update query on it i get an error: Notice: Undefined index: id in C:\Program Files\.... on line 5 Fatal error: Call to a member function fetch_assoc() on a non-object in C:\Program Files...on line 7
  5. I don't really see the offense there unless you understand any of the words you said as offensive, I was in fact doing what is implied by the site, giving an option to attach multiple files. to a question, perhaps that the part I misunderstood
  6. Good Day Everyone, I'm a new PHP coder, and so far I'm liking it a the moment I'm creating a simple blog with a little bit of validation and update and create procedures, to a database that has a table for the blogs created I have created 5 different files:index php, display.php. update.php. create php and auth php, so far my code can insert into the database and can also read from it but when it comes to UPDATE it I'm having a nightmare and I dont understand what i am doing wrong even though I have looked for all types of solutions I will attach my files here, as theres too many of them let me know if someone can help me out any help is kindly apprecciated Question.zip
×
×
  • 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.