Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29

Thread: PHP/MySQL Help

  1. #16
    New Coder
    Join Date
    May 2012
    Location
    Warminster, PA, USA
    Posts
    40
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by dan-dan View Post
    After you've done that try again and let me know whwat happens.
    Now, when I go to the edit page, select "Home" and click "Edit", it takes me to the index page with nothing where the text should go.

    (At least we got rid of the error message. )
    Kyle$calise

  2. #17
    Regular Coder dan-dan's Avatar
    Join Date
    Aug 2009
    Location
    England
    Posts
    483
    Thanks
    22
    Thanked 79 Times in 78 Posts
    See my last post, I just updated it! Don't forget you need something in the database too before it appears. I hope you didn't delete your content.

  3. #18
    New Coder
    Join Date
    May 2012
    Location
    Warminster, PA, USA
    Posts
    40
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by dan-dan View Post
    See my last post, I just updated it! Don't forget you need something in the database too before it appears. I hope you didn't delete your content.
    You've got me totally confused now.

    I had already ran the previous query you posted.

    (I didn't even know I had a table named pages.)
    Kyle$calise

  4. #19
    Regular Coder dan-dan's Avatar
    Join Date
    Aug 2009
    Location
    England
    Posts
    483
    Thanks
    22
    Thanked 79 Times in 78 Posts
    You didn't have a table until you ran that query which created it! However, I updated the query to add the 'home' and 'books' values to make your life a little easier.

    Just find that table named 'pages' and delete it. Then follow the steps again to recreate it with the new values.

    After that's done, if all goes right you should just be able to copy your HTML into the textarea and it should be saved into the database, thus displaying on your webpage

    Again, this is the code you need to use once it's deleted. I've highlighted in red the difference from the last table.:
    Code:
    -- phpMyAdmin SQL Dump
    -- version 3.4.5
    -- http://www.phpmyadmin.net
    --
    -- Host: 127.0.0.1
    -- Generation Time: Jun 09, 2012 at 02:12 AM
    -- Server version: 5.5.16
    -- PHP Version: 5.3.8
    
    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
    SET time_zone = "+00:00";
    
    
    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8 */;
    
    --
    -- Database: `pages`
    --
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `pages`
    --
    
    CREATE TABLE IF NOT EXISTS `pages` (
      `page` varchar(20) NOT NULL,
      `content` varchar(10000) NOT NULL,
      PRIMARY KEY (`page`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    --
    -- Dumping data for table `pages`
    --
    
    INSERT INTO `pages` (`page`, `content`) VALUES
    ('books', ''),
    ('home', '');
    
    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
    Last edited by dan-dan; 06-09-2012 at 01:34 AM.

  5. #20
    New Coder
    Join Date
    May 2012
    Location
    Warminster, PA, USA
    Posts
    40
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by dan-dan View Post
    You didn't have a table until you ran that query which created it! However, I updated the query to add the 'home' and 'books' values to make your life a little easier.

    Just find that table named 'pages' and delete it. Then follow the steps again to recreate it with the new values.

    After that's done, if all goes right you should just be able to copy your HTML into the textarea and it should be saved into the database, thus displaying on your webpage
    Okay... that's done. But it still doesn't show anything in the area.

    What's the difference between the "Edit" and "Submit" buttons? Here's what I've tried so far:

    *Select page (Home) in dropdown menu, and click "Edit". Takes me to the index page, with no text in the area.
    *Select page (Home) in dropdown menu, type in textarea, and click "Edit". Takes me to the index page, with no text in the area.
    *Select page (Home) in dropdown menu, type in textarea, and click "Submit". Takes me to the index page, with no text in the area.

    (Thanks so much for putting up with me. xD )
    Kyle$calise

  6. #21
    Regular Coder dan-dan's Avatar
    Join Date
    Aug 2009
    Location
    England
    Posts
    483
    Thanks
    22
    Thanked 79 Times in 78 Posts
    Click on home in the dropdown then click edit, meaning to edit the home page (it won't show anything at this point as you don't have anything saved in the database).

    Now type something into the textarea (which would normally contain the page content).

    Click submit to update the content.

    Maybe change the 'submit' value to 'save changes' to make it a bit clearer.

  7. #22
    New Coder
    Join Date
    May 2012
    Location
    Warminster, PA, USA
    Posts
    40
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by dan-dan View Post
    Click on home in the dropdown then click edit, meaning to edit the home page (it won't show anything at this point as you don't have anything saved in the database).
    I've tried that, and it just takes me to the index page with nothing in the editable area.
    Kyle$calise

  8. #23
    Regular Coder dan-dan's Avatar
    Join Date
    Aug 2009
    Location
    England
    Posts
    483
    Thanks
    22
    Thanked 79 Times in 78 Posts
    Lol. Just looked at the code you posted again and it's because you've got <form action="index.php" method="post"> on your edit page, meaning the index page will process the form.

    Change it to <form action="" method="post">

  9. Users who have thanked dan-dan for this post:

    Kyle$calise (06-09-2012)

  10. #24
    New Coder
    Join Date
    May 2012
    Location
    Warminster, PA, USA
    Posts
    40
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by dan-dan View Post
    Lol. Just looked at the code you posted again and it's because you've got <form action="index.php" method="post"> on your edit page, meaning the index page will process the form.

    Change it to <form action="" method="post">
    Yaaaay!!! Thank you, thank you, thank you!

    +1 Rep.

    I can't believe it! You're awesome!
    Kyle$calise

  11. #25
    Regular Coder dan-dan's Avatar
    Join Date
    Aug 2009
    Location
    England
    Posts
    483
    Thanks
    22
    Thanked 79 Times in 78 Posts
    No worries, glad we got there

    I'm not sure if you've done it already, but remember that on your books page you need to edit the query to:
    PHP Code:
    $result mysql_query('SELECT content FROM pages WHERE page ="books"'); 
    If you have any other problems with it just ask.

  12. #26
    New Coder
    Join Date
    May 2012
    Location
    Warminster, PA, USA
    Posts
    40
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Hey,

    Everything's working great.

    Just out of curiosity, would you have any idea how we might have the editor pick up on the current data?

    Example, select the page you want to edit, click "Edit", previous table entry appears in editor.

    That way, if someone makes a spelling error or something, they can just keep the same text, but change only a small bit of it.

    Any ideas?

    Thanks again!
    Kyle$calise

  13. #27
    Regular Coder dan-dan's Avatar
    Join Date
    Aug 2009
    Location
    England
    Posts
    483
    Thanks
    22
    Thanked 79 Times in 78 Posts
    Sorry, I'm confused! When you click edit after selecting a page, doesn't the current page already show in the textarea for edit? Does it just appear blank?

  14. #28
    New Coder
    Join Date
    May 2012
    Location
    Warminster, PA, USA
    Posts
    40
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by dan-dan View Post
    Sorry, I'm confused! When you click edit after selecting a page, doesn't the current page already show in the textarea for edit? Does it just appear blank?
    OMG, it does show it correctly!

    You're one step ahead of the game!

    Thanks!
    Kyle$calise

  15. #29
    Regular Coder dan-dan's Avatar
    Join Date
    Aug 2009
    Location
    England
    Posts
    483
    Thanks
    22
    Thanked 79 Times in 78 Posts
    Me one step ahead, or you one step behind haha


 
Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •