//We also need to show the the page content to be able to update the changes we make.
        protected void ShowPageContent(PagesDB db)
        {
            bool   valid  = true;
            string pageid = Request.QueryString["pageid"];

            if (String.IsNullOrEmpty(pageid))
            {
                valid = false;
            }

            if (valid)
            {
                HTTP_Page page_record = db.FindPage(Int32.Parse(pageid));


                page_title.Text     = page_record.GetPagetitle();
                page_body.Text      = page_record.GetPagebody();
                page_author.Text    = page_record.GetPageauthor();
                page_date.InnerHtml = page_record.GetTimeStamp().ToString("yyyy-MM-dd");
            }
            else
            {
                valid = false;
            }


            if (!valid)
            {
                page_content.InnerHtml = "There was an error finding that Page.";
            }
        }
        // we create a method so that we can add a page which directly sends the information to the table in the database.
        public void AddPage(HTTP_Page new_page)
        {
            //We write the query to instruct the method what we want it to do
            string query = "insert into pagesmgmt (pagetitle, pagebody, pageauthor, timestamp) values ('{0}','{1}','{2}','{3}')";

            query = String.Format(query, new_page.GetPagetitle(), new_page.GetPagebody(), new_page.GetPageauthor(), new_page.GetTimeStamp().ToString("yyyy-MM-dd"));

            MySqlConnection Connect = new MySqlConnection(ConnectionString);
            MySqlCommand    cmd     = new MySqlCommand(query, Connect);

            try
            {
                Connect.Open();
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                //We create debugs so that if something goes wrong we know on what part it was
                Debug.WriteLine("Something went wrong in the AddPage Method!");
                Debug.WriteLine(ex.ToString());
            }

            Connect.Close();
        }
        public void EditPage(int pageid, HTTP_Page new_page)
        {
            string query = "update pagesmgmt set pagetitle='{0}', pagebody='{1}', pageauthor='{2}' where pageid={3}";

            query = String.Format(query, new_page.GetPagetitle(), new_page.GetPagebody(), new_page.GetPageauthor(), pageid);

            MySqlConnection Connect = new MySqlConnection(ConnectionString);
            MySqlCommand    cmd     = new MySqlCommand(query, Connect);

            try
            {
                Connect.Open();
                cmd.ExecuteNonQuery();
                Debug.WriteLine("Executed query " + query);
            }
            catch (Exception ex)
            {
                //We create debugs so that if something goes wrong we know on what part it was
                Debug.WriteLine("Something went wrong in the EditPage method");
                Debug.WriteLine(ex.ToString());
            }

            Connect.Close();
        }