thedigicraft / Atom.CMS

Atom.CMS
56 stars 52 forks source link

Video 44 #119

Closed RosemaryRoss closed 9 years ago

RosemaryRoss commented 9 years ago

First, let me thank you for creating a great tutorial. I have gotten stuck on video 44, in that the code that DID work, is no longer working. The page would update, but not add a new page. I watched #44 so many times I think I can recite it verbatium, however....I've "redone" the code so many times that I'm just beyond confused and I feel I've messed the code up so bad that I don't know where I'm at in the code. Can anybody please show me the code that WORKS so I can move on. (I've gone back and redone my entire learning site three times already, I just don't have it in me to do it again from scratch.)

Thanks for any help given.

Rosemary

creptor commented 9 years ago

please provide the code(like function or part) that you whant and the posible file it's located in.

Or post your code, and I'll help you fix it.

RosemaryRoss commented 9 years ago

Oh that would be great.
The code is on my work computer, I’ll get it tomorrow.

R

From: creptor [mailto:notifications@github.com] Sent: Monday, April 20, 2015 8:01 PM To: thedigicraft/Atom.CMS Cc: Rose Subject: Re: [Atom.CMS] Video 44 (#119)

please provide the code(like function or part) that you whant and the posible file it's located in.

Or post your code, and I'll help you fix it.

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-94596583 . https://github.com/notifications/beacon/ALeh6FBdhx1k-cVG-ohVmqhfiW8WbhXcks5oBYrQgaJpZM4EEV0X.gif

creptor commented 9 years ago

allright, I'll be here tomorrow at 8pm:smile: EST -4:00

PD: remember to include the error(if any), and how it's supposed to work vs how is working

RosemaryRoss commented 9 years ago

Hopefully this isn't "Mission Impossible" for you. I know I've screwed the code up so bad that this is the error message: Parse error: syntax error, unexpected end of file in C:\wamp\www\Aptana\AtomCMS\admin\index.php on line 181 (181 being the last line in code).

The code used to work for "updating" the page. Although it said it ADDED a new page, it did not in reality. Tried very hard to find my mistake, and only created such a big mess that I'm totally confused, and really messed up the code.

I did the programming in Aptana (which is pretty cool), I think this is where the error is. If not....I'll try again. I think I'll have to copy this file and take it home so I have it available.

screenshot 2015-04-21 08 27 21

Gosh, I hope you can help, and this isn't too much trouble for you. R

creptor commented 9 years ago

you didn't close the else statement.... put a } right after the insert querry. :laughing:

RosemaryRoss commented 9 years ago

THAT was it???? OMG….I have found tiny mistakes like that before, but this time I was starting to go crazy. I’ll put that } in and hopefully that does the trick.

I’ll get back to you on that one, because it wasn’t adding a page…..SO, as soon as I put in the } I’ll try it out.

Thanks.

From: creptor [mailto:notifications@github.com] Sent: Tuesday, April 21, 2015 4:08 PM To: thedigicraft/Atom.CMS Cc: Rose Subject: Re: [Atom.CMS] Video 44 (#119)

you didn't close the else statement.... put a } right after the insert querry.

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-94922852 . https://github.com/notifications/beacon/ALeh6NOOTQXdnV4Xm3thAb6IDtkruBHcks5oBqWagaJpZM4EEV0X.gif

RosemaryRoss commented 9 years ago

Put the } in and the good news it that I can now see the form again. The bad news.....the form still does not work. Does not "add" a page, does not "update a page". I hate to add three screen shots, but here is the code from my index page in the admin folder. screenshot 2015-04-22 08 30 51 screenshot 2015-04-22 08 31 34 screenshot 2015-04-22 08 32 05

creptor commented 9 years ago

if you have any errors please post them. It's necesarry that you actually tell me what is not working, and how it's supossed to work, please.

PD: if no error is been given, then place error_reporting(-1) at setup.php (or whatever is called first in the page) to display code errors.

RosemaryRoss commented 9 years ago

That is just it. I don’t get an error message. When you make an “update”, you get the message the update was made, but in reality it was not. When you try to add a new page, the message is given new page added, but there is no new page.

From: creptor [mailto:notifications@github.com] Sent: Wednesday, April 22, 2015 7:21 PM To: thedigicraft/Atom.CMS Cc: Rose Subject: Re: [Atom.CMS] Video 44 (#119)

if you have any errors please post them. It's necesarry that you actually tell me what is not working, and how it's supossed to work, please.

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-95365642 . https://github.com/notifications/beacon/ALeh6Fes9_K2EK52z1sH8ePr19APsnjiks5oCCRTgaJpZM4EEV0X.gif

JasonMate commented 9 years ago

The method attribute in your form tag looks like it has a space that doesn't belong there, right after the =

On Wed, Apr 22, 2015 at 8:11 PM, Rose notifications@github.com wrote:

That is just it. I don’t get an error message. When you make an “update”, you get the message the update was made, but in reality it was not. When you try to add a new page, the message is given new page added, but there is no new page.

From: creptor [mailto:notifications@github.com] Sent: Wednesday, April 22, 2015 7:21 PM To: thedigicraft/Atom.CMS Cc: Rose Subject: Re: [Atom.CMS] Video 44 (#119)

if you have any errors please post them. It's necesarry that you actually tell me what is not working, and how it's supossed to work, please.

— Reply to this email directly or view it on GitHub < https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-95365642> . < https://github.com/notifications/beacon/ALeh6Fes9_K2EK52z1sH8ePr19APsnjiks5oCCRTgaJpZM4EEV0X.gif>

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-95392014 .

RosemaryRoss commented 9 years ago

I sincerely wished that was the issue. Took out the space and the form still does not do the ACTION. It does not update, it does not add a page. Just refreshes.

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Thursday, April 23, 2015 6:57:05 AM Subject: Re: [Atom.CMS] Video 44 (#119)

The method attribute in your form tag looks like it has a space that doesn't belong there, right after the =

On Wed, Apr 22, 2015 at 8:11 PM, Rose notifications@github.com wrote:

That is just it. I don’t get an error message. When you make an “update”, you get the message the update was made, but in reality it was not. When you try to add a new page, the message is given new page added, but there is no new page.

From: creptor [mailto:notifications@github.com] Sent: Wednesday, April 22, 2015 7:21 PM To: thedigicraft/Atom.CMS Cc: Rose Subject: Re: [Atom.CMS] Video 44 (#119)

if you have any errors please post them. It's necesarry that you actually tell me what is not working, and how it's supossed to work, please.

— Reply to this email directly or view it on GitHub < https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-95365642> . < https://github.com/notifications/beacon/ALeh6Fes9_K2EK52z1sH8ePr19APsnjiks5oCCRTgaJpZM4EEV0X.gif>

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-95392014 .

— Reply to this email directly or view it on GitHub .

JasonMate commented 9 years ago

It says "updated" but the pages are not going the database? Can you take a screenshot of your pages table?

On Thu, Apr 23, 2015 at 9:23 AM, Rose notifications@github.com wrote:

I sincerely wished that was the issue. Took out the space and the form still does not do the ACTION. It does not update, it does not add a page. Just refreshes.

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Thursday, April 23, 2015 6:57:05 AM Subject: Re: [Atom.CMS] Video 44 (#119)

The method attribute in your form tag looks like it has a space that doesn't belong there, right after the =

On Wed, Apr 22, 2015 at 8:11 PM, Rose notifications@github.com wrote:

That is just it. I don’t get an error message. When you make an “update”, you get the message the update was made, but in reality it was not. When you try to add a new page, the message is given new page added, but there is no new page.

From: creptor [mailto:notifications@github.com] Sent: Wednesday, April 22, 2015 7:21 PM To: thedigicraft/Atom.CMS Cc: Rose Subject: Re: [Atom.CMS] Video 44 (#119)

if you have any errors please post them. It's necesarry that you actually tell me what is not working, and how it's supossed to work, please.

— Reply to this email directly or view it on GitHub <

https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-95365642>

. <

https://github.com/notifications/beacon/ALeh6Fes9_K2EK52z1sH8ePr19APsnjiks5oCCRTgaJpZM4EEV0X.gif>

— Reply to this email directly or view it on GitHub < https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-95392014>

.

— Reply to this email directly or view it on GitHub .

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-95623705 .

RosemaryRoss commented 9 years ago

Glad to know you didn't give up on me. screenshot 2015-04-23 13 50 54

JasonMate commented 9 years ago

I'm pretty sure the problem is your INSERT query. It's hard to see in the screenshot, but it looks like VALUES portion of that query is missing the variables you created above.

Should look like this:

$q = "INSERT INTO pages (user, slug, title, label, header, body) VALUES ($_POST[user], '$_POST[slug]', '$title', '$label', '$header', '$body')";

Let us pray that is the problem :)

On Thu, Apr 23, 2015 at 11:52 AM, Rose notifications@github.com wrote:

Glad to know you didn't give up on me. [image: screenshot 2015-04-23 13 50 54] https://cloud.githubusercontent.com/assets/12034536/7303610/e7a7339e-e9bf-11e4-9990-db464b87dc2a.png

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-95669049 .

RosemaryRoss commented 9 years ago

I know tiny little mistakes cause huge problems. And, the screenshot isn't so great. SO, here is the entire php block. I think the INSERT is as you have below (or I've gone batty looking at it so long).

<?php

if(isset($_POST['submitted']) == 1){

//need to create an "escape" to deal with apostropies and things that break code, ie Alan's page $title = mysqli_real_escape_string($dbc, $_POST['title']); $label = mysqli_real_escape_string($dbc, $_POST['label']); $header = mysqli_real_escape_string($dbc, $_POST['header']); $body = mysqli_real_escape_string($dbc, $_POST['body']);

if(isset($_POST['id']) != ''){ $action = 'updated';

$q = "UPDATE pages SET user = $_POST[user], slug = '$_POST[slug]', title = '$title', label = '$label', header = '$header', body = '$body' WHERE id = $_GET[id]"; }else{ $action = 'added'; $q = "INSERT INTO pages (user, slug, title, label, header, body) VALUES($_POST[user], '$_POST[slug]', 'title', 'label', 'header', 'body')";

$r = mysqli_query($dbc, $q);

}if($r){

echo '

Page was '.$action.'!

'; }else { echo '

Page could not be '.$action.' because: '.mysqli_error($dbc); echo '

' .$q. '

'; } }

?>

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Thursday, April 23, 2015 2:56:16 PM Subject: Re: [Atom.CMS] Video 44 (#119)

I'm pretty sure the problem is your INSERT query. It's hard to see in the screenshot, but it looks like VALUES portion of that query is missing the variables you created above.

Should look like this:

$q = "INSERT INTO pages (user, slug, title, label, header, body) VALUES ($_POST[user], '$_POST[slug]', '$title', '$label', '$header', '$body')";

Let us pray that is the problem :)

On Thu, Apr 23, 2015 at 11:52 AM, Rose notifications@github.com wrote:

Glad to know you didn't give up on me. [image: screenshot 2015-04-23 13 50 54] https://cloud.githubusercontent.com/assets/12034536/7303610/e7a7339e-e9bf-11e4-9990-db464b87dc2a.png

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-95669049 .

— Reply to this email directly or view it on GitHub .

JasonMate commented 9 years ago

Replace this: $q = "INSERT INTO pages (user, slug, title, label, header, body) VALUES($_POST[user], '$_POST[slug]', 'title', 'label', 'header', 'body')";

With this: $q = "INSERT INTO pages (user, slug, title, label, header, body) VALUES($_POST[user], '$_POST[slug]', '$title', '$label', '$header', '$body')";

On Thu, Apr 23, 2015 at 1:58 PM, Rose notifications@github.com wrote:

I know tiny little mistakes cause huge problems. And, the screenshot isn't so great. SO, here is the entire php block. I think the INSERT is as you have below (or I've gone batty looking at it so long).

<?php

if(isset($_POST['submitted']) == 1){

//need to create an "escape" to deal with apostropies and things that break code, ie Alan's page $title = mysqli_real_escape_string($dbc, $_POST['title']); $label = mysqli_real_escape_string($dbc, $_POST['label']); $header = mysqli_real_escape_string($dbc, $_POST['header']); $body = mysqli_real_escape_string($dbc, $_POST['body']);

if(isset($_POST['id']) != ''){ $action = 'updated';

$q = "UPDATE pages SET user = $_POST[user], slug = '$_POST[slug]', title = '$title', label = '$label', header = '$header', body = '$body' WHERE id = $_GET[id]"; }else{ $action = 'added'; $q = "INSERT INTO pages (user, slug, title, label, header, body) VALUES($_POST[user], '$_POST[slug]', 'title', 'label', 'header', 'body')";

$r = mysqli_query($dbc, $q);

}if($r){

echo '

Page was '.$action.'!

'; }else { echo '

Page could not be '.$action.' because: '.mysqli_error($dbc); echo '

' .$q. '

'; } }

?>

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Thursday, April 23, 2015 2:56:16 PM Subject: Re: [Atom.CMS] Video 44 (#119)

I'm pretty sure the problem is your INSERT query. It's hard to see in the screenshot, but it looks like VALUES portion of that query is missing the variables you created above.

Should look like this:

$q = "INSERT INTO pages (user, slug, title, label, header, body) VALUES ($_POST[user], '$_POST[slug]', '$title', '$label', '$header', '$body')";

Let us pray that is the problem :)

On Thu, Apr 23, 2015 at 11:52 AM, Rose notifications@github.com wrote:

Glad to know you didn't give up on me. [image: screenshot 2015-04-23 13 50 54] < https://cloud.githubusercontent.com/assets/12034536/7303610/e7a7339e-e9bf-11e4-9990-db464b87dc2a.png>

— Reply to this email directly or view it on GitHub < https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-95669049>

.

— Reply to this email directly or view it on GitHub .

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-95701206 .

creptor commented 9 years ago

You have your update query wrong. It appears you're ussing the $_POST data but in the update query you use the $_GET, please replace this:

$q = "UPDATE pages SET user = $_POST[user], slug = '$_POST[slug]', title = '$title', label = '$label', header = '$header', body = '$body' WHERE id = $_GET[id]";

to this:

$q = "UPDATE pages SET user = $_POST[user], slug = '$_POST[slug]', title = '$title', label = '$label', header = '$header', body = '$body' WHERE id = $_POST[id]";

Or the other way around, with $_GET instead of $_POST. It depends of your form method.

RosemaryRoss commented 9 years ago

JasonMate - I used your replacement...unfortunately, it didn't work. The form just sits there, no update, no new page either.

Creptor - I tried your suggestion and changed the code from $_GET[id]"; to $_POST[id]"; and that didn't work. I used the POST with both mine and CodeMate's suggested change and still, the form does nothing.
I'm feeling like a hopeless cause :-( And, I can't move forward with the tutorials until this works.

JasonMate commented 9 years ago

Hey Rose, I'll try and help you resolve it after I get off work this afternoon. Also I would look and study the queries Alan is using for that page here: https://github.com/thedigicraft/Atom.CMS/blob/master/admin/config/queries.php

On Fri, Apr 24, 2015 at 6:41 AM, Rose notifications@github.com wrote:

JasonMate - I used your replacement...unfortunately, it didn't work. The form just sits there, no update, no new page either.

Creptor - I tried your suggestion and changed the code from $_GET[id]"; to $_POST[id]"; and that didn't work. I used the POST with both mine and CodeMate's suggested change and still, the form does nothing.

I'm feeling like a hopeless cause :-( And, I can't move forward with the tutorials until this works.

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-95920440 .

RosemaryRoss commented 9 years ago

Thanks, I do appreciate your help. Don't knock yourself out though, as I'm going to be out of town this weekend, and I can't work on it until Monday. BUT, I will watch the video this afternoon, and go back and review the tutorials (again)....just maybe some lightning bolt will happen!! R

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Friday, April 24, 2015 11:27:49 AM Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose, I'll try and help you resolve it after I get off work this afternoon. Also I would look and study the queries Alan is using for that page here: https://github.com/thedigicraft/Atom.CMS/blob/master/admin/config/queries.php

On Fri, Apr 24, 2015 at 6:41 AM, Rose notifications@github.com wrote:

JasonMate - I used your replacement...unfortunately, it didn't work. The form just sits there, no update, no new page either.

Creptor - I tried your suggestion and changed the code from $_GET[id]"; to $_POST[id]"; and that didn't work. I used the POST with both mine and CodeMate's suggested change and still, the form does nothing.

I'm feeling like a hopeless cause :-( And, I can't move forward with the tutorials until this works.

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-95920440 .

— Reply to this email directly or view it on GitHub .

RosemaryRoss commented 9 years ago

I think you are right. I DO have a problem with /config/queries.php I need to go back and review the videos to find where I missed creating this file. My setup makes reference to it, but I don't have that file. Back to the videos.

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Friday, April 24, 2015 11:27:49 AM Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose, I'll try and help you resolve it after I get off work this afternoon. Also I would look and study the queries Alan is using for that page here: https://github.com/thedigicraft/Atom.CMS/blob/master/admin/config/queries.php

On Fri, Apr 24, 2015 at 6:41 AM, Rose notifications@github.com wrote:

JasonMate - I used your replacement...unfortunately, it didn't work. The form just sits there, no update, no new page either.

Creptor - I tried your suggestion and changed the code from $_GET[id]"; to $_POST[id]"; and that didn't work. I used the POST with both mine and CodeMate's suggested change and still, the form does nothing.

I'm feeling like a hopeless cause :-( And, I can't move forward with the tutorials until this works.

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-95920440 .

— Reply to this email directly or view it on GitHub .

creptor commented 9 years ago

consider posting the hole actual code in here. It would be more helpfull than the images....You could use http://pastebin.com/ .

I'll need the file where the form is,and where the query is. (considerating that everything else works perfectly and the database is correctly input by the queries)

RosemaryRoss commented 9 years ago

Thank you...I took out ALL my code for the form and started over. When I get to that video 44, and I still have issues.....I'll implore your help again....I can't find my mistake so I'm just trying it all over again.

RosemaryRoss commented 9 years ago

Totally redid the coding. Got to video 44. I can ADD a page, but I cannot UPDATE a page. the admin page just keeps adding a new page instead of updating the content of a page. I can't make alterations to an already created page.

RosemaryRoss commented 9 years ago

Okay. I've spent the last 3 days completely redoing the code, starting from scratch. Got to video 44 and have the same issues. Looking over the other questions posted...it appears there is an ISSUE with video 44 and the code therein.

One thing I noted (after watching the video 10 times, was that Digicraft said $ when in reality he meant ?, so there may be another error somewhere in there that I, as a student, cannot pick up on.

Here is the error: Page could not be added because:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[id]' at line 1

UPDATE pages SET user = 2, slug = 'about-us', title = 'About Us 5', label = 'About', header = 'About AtomCMS', body = '

Same error everyone else got. (they probably didn't redo the code 50+ times though)

My index.php code is as follows:

<?php

START THE SESSION

session_start(); // session is an array and starts the session

if (!isset($_SESSION['username'])) {// this is what checks if a person is logged in. username is the key. // IF not logged in, then header function sends user back to login page. header('Location: login.php'); } ?>

<?php include ('config/setup.php'); ?>

<!DOCTYPE html>

``` <?php echo $page['title'] . ' | ' . $site_title; ?>
```

Admin Dashboard

Page was added!'; } else { $message = '

Page could not be added because:' .mysqli_error($dbc); $message .= '

' .$q. '

'; } } ?>
```

I really do not want to give up learning, but I've hit a brick wall. I seriously believe there is an issue in that particular video (or so many people would not have issue with it.)

JasonMate commented 9 years ago

Hey Rose,

I am chained to the comp for a couple hours so I can help if you want. :)

In your form tag I see your trying to echo out the array, It just needs $opened['id']

<form action="index.php?id=<?php echo $opened['id']; ?>" method="post" role="form"> Also you may need to change this little bit of code here:

Must keep at $_GET as post does not work

if(isset($_GET['id']) != '') { Its supposed to be: if(isset($_POST['id']) != '') { Regards, Jason M On Thu, Apr 30, 2015 at 1:40 PM, Rose notifications@github.com wrote:

Okay. I've spent the last 3 days completely redoing the code, starting from scratch. Got to video 44 and have the same issues. Looking over the other questions posted...it appears there is an ISSUE with video 44 and the code therein.

One thing I noted (after watching the video 10 times, was that Digicraft said $ when in reality he meant ?, so there may be another error somewhere in there that I, as a student, cannot pick up on.

Here is the error: Page could not be added because:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[id]' at line 1

UPDATE pages SET user = 2, slug = 'about-us', title = 'About Us 5', label = 'About', header = 'About AtomCMS', body = '

Same error everyone else got. (they probably didn't redo the code 50+ times though)

My index.php code is as follows:

<?php

START THE SESSION

session_start(); // session is an array and starts the session

if (!isset($_SESSION['username'])) {// this is what checks if a person is logged in. username is the key. // IF not logged in, then header function sends user back to login page. header('Location: login.php'); } ?>

<?php include ('config/setup.php'); ?>

<!DOCTYPE html>

<?php echo $page['title'] . ' | ' . $site_title; ?>

Admin Dashboard

Page was added!'; } else { $message = '

Page could not be added because:' .mysqli_error($dbc); $message .= '

' .$q. '

'; } } ?>
```
```

I really do not want to give up learning, but I've hit a brick wall. I seriously believe there is an issue in that particular video (or so many people would not have issue with it.)

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-97941362 .

JasonMate commented 9 years ago

I don't know if this matters, but you can remove the space between $_GET and [id] in your update query.

WHERE id = $_GET[id]

On Thu, Apr 30, 2015 at 2:16 PM, Jason Mate jmate421@gmail.com wrote:

Hey Rose,

I am chained to the comp for a couple hours so I can help if you want. :)

In your form tag I see your trying to echo out the array, It just needs $opened['id']

<form action="index.php?id=<?php echo $opened['id']; ?>" method="post" role="form"> Also you may need to change this little bit of code here:

Must keep at $_GET as post does not work

if(isset($_GET['id']) != '') { Its supposed to be: if(isset($_POST['id']) != '') { Regards, Jason M On Thu, Apr 30, 2015 at 1:40 PM, Rose notifications@github.com wrote:

Okay. I've spent the last 3 days completely redoing the code, starting from scratch. Got to video 44 and have the same issues. Looking over the other questions posted...it appears there is an ISSUE with video 44 and the code therein.

One thing I noted (after watching the video 10 times, was that Digicraft said $ when in reality he meant ?, so there may be another error somewhere in there that I, as a student, cannot pick up on.

Here is the error: Page could not be added because:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[id]' at line 1

UPDATE pages SET user = 2, slug = 'about-us', title = 'About Us 5', label = 'About', header = 'About AtomCMS', body = '

Same error everyone else got. (they probably didn't redo the code 50+ times though)

My index.php code is as follows:

<?php

START THE SESSION

session_start(); // session is an array and starts the session

if (!isset($_SESSION['username'])) {// this is what checks if a person is logged in. username is the key. // IF not logged in, then header function sends user back to login page. header('Location: login.php'); } ?>

<?php include ('config/setup.php'); ?>

<!DOCTYPE html>

<?php echo $page['title'] . ' | ' . $site_title; ?>

Admin Dashboard

Page was added!'; } else { $message = '

Page could not be added because:' .mysqli_error($dbc); $message .= '

' .$q. '

'; } } ?>
```
```

I really do not want to give up learning, but I've hit a brick wall. I seriously believe there is an issue in that particular video (or so many people would not have issue with it.)

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-97941362 .

RosemaryRoss commented 9 years ago

I’m SO sorry the code is on my work computer (I’m trying to learn php for our web site) and I don’t have it here at home. I will most certainly try a few of the suggestions you listed, but I know for a fact that the > if(isset($_POST['id']) != '') { does not work…that is why I made a note to myself to quit trying it.

I hope one of your suggestions work when I try it tomorrow morning. I’m ready to throw in the towel.

R

(BTW ~~ from the id count…I can tell today alone I “added” 20 pages and not one update)

From: JasonMate [mailto:notifications@github.com] Sent: Thursday, April 30, 2015 5:32 PM To: thedigicraft/Atom.CMS Cc: Rose Subject: Re: [Atom.CMS] Video 44 (#119)

I don't know if this matters, but you can remove the space between $_GET and [id] in your update query.

WHERE id = $_GET[id]

On Thu, Apr 30, 2015 at 2:16 PM, Jason Mate jmate421@gmail.com wrote:

Hey Rose,

I am chained to the comp for a couple hours so I can help if you want. :)

In your form tag I see your trying to echo out the array, It just needs $opened['id']

<form action="index.php?id=<?php echo $opened['id']; ?>" method="post" role="form"> Also you may need to change this little bit of code here:

Must keep at $_GET as post does not work

if(isset($_GET['id']) != '') { Its supposed to be: if(isset($_POST['id']) != '') { Regards, Jason M On Thu, Apr 30, 2015 at 1:40 PM, Rose notifications@github.com wrote:

Okay. I've spent the last 3 days completely redoing the code, starting from scratch. Got to video 44 and have the same issues. Looking over the other questions posted...it appears there is an ISSUE with video 44 and the code therein.

One thing I noted (after watching the video 10 times, was that Digicraft said $ when in reality he meant ?, so there may be another error somewhere in there that I, as a student, cannot pick up on.

Here is the error: Page could not be added because:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[id]' at line 1

UPDATE pages SET user = 2, slug = 'about-us', title = 'About Us 5', label = 'About', header = 'About AtomCMS', body = '

Same error everyone else got. (they probably didn't redo the code 50+ times though)

My index.php code is as follows:

<?php

START THE SESSION

session_start(); // session is an array and starts the session

if (!isset($_SESSION['username'])) {// this is what checks if a person is logged in. username is the key. // IF not logged in, then header function sends user back to login page. header('Location: login.php'); } ?>

<?php include ('config/setup.php'); ?>

<!DOCTYPE html>

<?php echo $page['title'] . ' | ' . $site_title; ?>

Admin Dashboard

Page was added!'; } else { $message = '

Page could not be added because:' .mysqli_error($dbc); $message .= '

' .$q. '

'; } } ?>

I really do not want to give up learning, but I've hit a brick wall. I seriously believe there is an issue in that particular video (or so many people would not have issue with it.)

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-97941362 .

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-97974916 . https://github.com/notifications/beacon/ALeh6BhnffPadmKSk21YNDk5YSHuR2Nrks5oEpbPgaJpZM4EEV0X.gif

RosemaryRoss commented 9 years ago

I wish there was a better way to communicate. This is getting lengthy. I made the first change suggested (the form action=) Here is the error message:

Page could not be added because:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[id]' at line 1

UPDATE pages SET user = 2, slug = 'about-us', title = 'About Us ', label = 'About', header = 'About AtomCMS', body = '

Even though changing $_GET to $_POST has not worked in the past...I'll give it a try in conjunction with the above change.

R ----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Thursday, April 30, 2015 4:16:06 PM Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

I am chained to the comp for a couple hours so I can help if you want. :)

In your form tag I see your trying to echo out the array, It just needs $opened['id']

<form action="index.php?id=<?php echo $opened['id']; ?>" method="post" role="form"> Also you may need to change this little bit of code here:

Must keep at $_GET as post does not work

if(isset($_GET['id']) != '') { Its supposed to be: if(isset($_POST['id']) != '') { Regards, Jason M On Thu, Apr 30, 2015 at 1:40 PM, Rose notifications@github.com wrote:

Okay. I've spent the last 3 days completely redoing the code, starting from scratch. Got to video 44 and have the same issues. Looking over the other questions posted...it appears there is an ISSUE with video 44 and the code therein.

One thing I noted (after watching the video 10 times, was that Digicraft said $ when in reality he meant ?, so there may be another error somewhere in there that I, as a student, cannot pick up on.

Here is the error: Page could not be added because:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[id]' at line 1

UPDATE pages SET user = 2, slug = 'about-us', title = 'About Us 5', label = 'About', header = 'About AtomCMS', body = '

Same error everyone else got. (they probably didn't redo the code 50+ times though)

My index.php code is as follows:

<?php

START THE SESSION

session_start(); // session is an array and starts the session

if (!isset($_SESSION['username'])) {// this is what checks if a person is logged in. username is the key. // IF not logged in, then header function sends user back to login page. header('Location: login.php'); } ?>

<?php include ('config/setup.php'); ?>

<!DOCTYPE html>

<?php echo $page['title'] . ' | ' . $site_title; ?>

Admin Dashboard

Page was added!'; } else { $message = '

Page could not be added because:' .mysqli_error($dbc); $message .= '

' .$q. '

'; } } ?>
I really do not want to give up learning, but I've hit a brick wall. I seriously believe there is an issue in that particular video (or so many people would not have issue with it.) — Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-97941362 .

— Reply to this email directly or view it on GitHub .

RosemaryRoss commented 9 years ago

There is an error in the code that is supposed to update. Prior to adding that code I COULD add a new page. After adding that update code I can no longer add a page either. SO, the code for making the update is obviously wrong. I am trying to learn how to code, so I can't figure out the error. BUT, through deductive reasoning, I know the error is in the update code. I'm sad you could not spot the problem. R

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Thursday, April 30, 2015 5:31:59 PM Subject: Re: [Atom.CMS] Video 44 (#119)

I don't know if this matters, but you can remove the space between $_GET and [id] in your update query.

WHERE id = $_GET[id]

On Thu, Apr 30, 2015 at 2:16 PM, Jason Mate jmate421@gmail.com wrote:

Hey Rose,

I am chained to the comp for a couple hours so I can help if you want. :)

In your form tag I see your trying to echo out the array, It just needs $opened['id']

<form action="index.php?id=<?php echo $opened['id']; ?>" method="post" role="form"> Also you may need to change this little bit of code here:

Must keep at $_GET as post does not work

if(isset($_GET['id']) != '') { Its supposed to be: if(isset($_POST['id']) != '') { Regards, Jason M On Thu, Apr 30, 2015 at 1:40 PM, Rose notifications@github.com wrote:

Okay. I've spent the last 3 days completely redoing the code, starting from scratch. Got to video 44 and have the same issues. Looking over the other questions posted...it appears there is an ISSUE with video 44 and the code therein.

One thing I noted (after watching the video 10 times, was that Digicraft said $ when in reality he meant ?, so there may be another error somewhere in there that I, as a student, cannot pick up on.

Here is the error: Page could not be added because:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[id]' at line 1

UPDATE pages SET user = 2, slug = 'about-us', title = 'About Us 5', label = 'About', header = 'About AtomCMS', body = '

Same error everyone else got. (they probably didn't redo the code 50+ times though)

My index.php code is as follows:

<?php

START THE SESSION

session_start(); // session is an array and starts the session

if (!isset($_SESSION['username'])) {// this is what checks if a person is logged in. username is the key. // IF not logged in, then header function sends user back to login page. header('Location: login.php'); } ?>

<?php include ('config/setup.php'); ?>

<!DOCTYPE html>

<?php echo $page['title'] . ' | ' . $site_title; ?>

Admin Dashboard

Page was added!'; } else { $message = '

Page could not be added because:' .mysqli_error($dbc); $message .= '

' .$q. '

'; } } ?>
I really do not want to give up learning, but I've hit a brick wall. I seriously believe there is an issue in that particular video (or so many people would not have issue with it.) — Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-97941362 .

— Reply to this email directly or view it on GitHub .

creptor commented 9 years ago

I have just found it.... in the query here:

$q = "UPDATE pages SET user = $_POST[user], slug = '$_POST[slug]', title = '$title', label = '$label', header = '$header', body = '$body' WHERE id = $_GET [id]";

You placed a space in between the $_GET and the [id] so the php doesn't recognizes the variable... please fix it.($_GET[id])

RosemaryRoss commented 9 years ago

Shucks....I wish that was it. JasonMate mentioned that fix yesterday. I corrected it this morning....and it still didn't work. The problem is definitely in the UPDATE though, because before I put that in, it added a page just fine. Now....it doesn't update OR add a new page.

BTW ~ Thanks. It is those LITTLE things that make a BIG difference in the code, and I need to learn so many. So I appreciate the insights.

JasonMate commented 9 years ago

Hey Rose,

Ok here are the problems I see with the code.

  1. The form tag.
You are appending an array to the id. It needs to be like this: 1. The form uses the the POST method but you are checking for a GET. I think the reason its not working is because the id would be coming in empty every time and just post rather than update. # Must keep at $_GET as post does not work if(isset($_GET['id']) != '') { This needs to be post because the form submits the $opened['id'] in a hidden field at the bottom of your form. 1. Here's the update query you have: $q = "UPDATE pages SET user = $_POST[user], slug = '$_POST[slug]', title = '$title', label = '$label', header = '$header', body = '$body' WHERE id = $_GET [id]"; Everything looks good except the very last part. You need to remove the space between $_GET and [id] Please fix all these problems first and test it. If there is still problems we can drill down further and take a closer look, but the obvious problems need to be fixed first. Also it will be a lot easier to look at your code if you use http://pastebin.com/ and share all the files involved. I know bugged code can be extremely frustrating. Just keep at it like the rest of us and eventually you figure it out. :) Jason M On Fri, May 1, 2015 at 6:03 PM, Rose notifications@github.com wrote: > Shucks....I wish that was it. JasonMate mentioned that fix yesterday. I > corrected it this morning....and it still didn't work. The problem is > definitely in the UPDATE though, because before I put that in, it added a > page just fine. Now....it doesn't update OR add a new page. > > — > Reply to this email directly or view it on GitHub > https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-98264309 > .
RosemaryRoss commented 9 years ago

Made a little progress with your suggestions below. I can now UPDATE a page, but not ADD a new page. I joined paste.bin (not sure I pasted properly and all that is needed). Does what I pasted help solve the mystery?? Need more files?? And, again, THANKS. R

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Saturday, May 2, 2015 4:32:22 PM Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

Ok here are the problems I see with the code.

  1. The form tag.
You are appending an array to the id. It needs to be like this: 1. The form uses the the POST method but you are checking for a GET. I think the reason its not working is because the id would be coming in empty every time and just post rather than update. # Must keep at $_GET as post does not work if(isset($_GET['id']) != '') { This needs to be post because the form submits the $opened['id'] in a hidden field at the bottom of your form. 1. Here's the update query you have: $q = "UPDATE pages SET user = $_POST[user], slug = '$_POST[slug]', title = '$title', label = '$label', header = '$header', body = '$body' WHERE id = $_GET [id]"; Everything looks good except the very last part. You need to remove the space between $_GET and [id] Please fix all these problems first and test it. If there is still problems we can drill down further and take a closer look, but the obvious problems need to be fixed first. Also it will be a lot easier to look at your code if you use http://pastebin.com/ and share all the files involved. I know bugged code can be extremely frustrating. Just keep at it like the rest of us and eventually you figure it out. :) Jason M On Fri, May 1, 2015 at 6:03 PM, Rose notifications@github.com wrote: > Shucks....I wish that was it. JasonMate mentioned that fix yesterday. I > corrected it this morning....and it still didn't work. The problem is > definitely in the UPDATE though, because before I put that in, it added a > page just fine. Now....it doesn't update OR add a new page. > > — > Reply to this email directly or view it on GitHub > https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-98264309 > . — Reply to this email directly or view it on GitHub .
JasonMate commented 9 years ago

Hey Rose,

I can help after work. Can you provide some links to the pastes you put up? Please don't paste your connection file.

best regards,

Jason M

On Mon, May 4, 2015 at 8:14 AM, Rose notifications@github.com wrote:

Made a little progress with your suggestions below. I can now UPDATE a page, but not ADD a new page. I joined paste.bin (not sure I pasted properly and all that is needed). Does what I pasted help solve the mystery?? Need more files?? And, again, THANKS. R

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Saturday, May 2, 2015 4:32:22 PM Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

Ok here are the problems I see with the code.

  1. The form tag.
You are appending an array to the id. It needs to be like this: 1. The form uses the the POST method but you are checking for a GET. I think the reason its not working is because the id would be coming in empty every time and just post rather than update. # Must keep at $_GET as post does not work if(isset($_GET['id']) != '') { This needs to be post because the form submits the $opened['id'] in a hidden field at the bottom of your form. 1. Here's the update query you have: $q = "UPDATE pages SET user = $_POST[user], slug = '$_POST[slug]', title = '$title', label = '$label', header = '$header', body = '$body' WHERE id = $_GET [id]"; Everything looks good except the very last part. You need to remove the space between $_GET and [id] Please fix all these problems first and test it. If there is still problems we can drill down further and take a closer look, but the obvious problems need to be fixed first. Also it will be a lot easier to look at your code if you use http://pastebin.com/ and share all the files involved. I know bugged code can be extremely frustrating. Just keep at it like the rest of us and eventually you figure it out. :) Jason M On Fri, May 1, 2015 at 6:03 PM, Rose notifications@github.com wrote: > Shucks....I wish that was it. JasonMate mentioned that fix yesterday. I > corrected it this morning....and it still didn't work. The problem is > definitely in the UPDATE though, because before I put that in, it added > a > page just fine. Now....it doesn't update OR add a new page. > > — > Reply to this email directly or view it on GitHub > < > https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-98264309> > > . — Reply to this email directly or view it on GitHub . — Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-98723747 .
RosemaryRoss commented 9 years ago

What do you need as links?? (sorry, ...new at this) I posted 5 files. I'm not sure what other files are needed.

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Monday, May 4, 2015 11:11:21 AM Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

I can help after work. Can you provide some links to the pastes you put up? Please don't paste your connection file.

best regards,

Jason M

On Mon, May 4, 2015 at 8:14 AM, Rose notifications@github.com wrote:

Made a little progress with your suggestions below. I can now UPDATE a page, but not ADD a new page. I joined paste.bin (not sure I pasted properly and all that is needed). Does what I pasted help solve the mystery?? Need more files?? And, again, THANKS. R

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Saturday, May 2, 2015 4:32:22 PM Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

Ok here are the problems I see with the code.

  1. The form tag.
You are appending an array to the id. It needs to be like this: 1. The form uses the the POST method but you are checking for a GET. I think the reason its not working is because the id would be coming in empty every time and just post rather than update. # Must keep at $_GET as post does not work if(isset($_GET['id']) != '') { This needs to be post because the form submits the $opened['id'] in a hidden field at the bottom of your form. 1. Here's the update query you have: $q = "UPDATE pages SET user = $_POST[user], slug = '$_POST[slug]', title = '$title', label = '$label', header = '$header', body = '$body' WHERE id = $_GET [id]"; Everything looks good except the very last part. You need to remove the space between $_GET and [id] Please fix all these problems first and test it. If there is still problems we can drill down further and take a closer look, but the obvious problems need to be fixed first. Also it will be a lot easier to look at your code if you use http://pastebin.com/ and share all the files involved. I know bugged code can be extremely frustrating. Just keep at it like the rest of us and eventually you figure it out. :) Jason M On Fri, May 1, 2015 at 6:03 PM, Rose notifications@github.com wrote: > Shucks....I wish that was it. JasonMate mentioned that fix yesterday. I > corrected it this morning....and it still didn't work. The problem is > definitely in the UPDATE though, because before I put that in, it added > a > page just fine. Now....it doesn't update OR add a new page. > > — > Reply to this email directly or view it on GitHub > < > https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-98264309> > > . — Reply to this email directly or view it on GitHub . — Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-98723747 .

— Reply to this email directly or view it on GitHub .

JasonMate commented 9 years ago

If you posted the files on pastebin.com then I will need the links to each file you posted.

Like this: http://pastebin.com/ubgGNsED

On Mon, May 4, 2015 at 9:24 AM, Rose notifications@github.com wrote:

What do you need as links?? (sorry, ...new at this) I posted 5 files. I'm not sure what other files are needed.

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Monday, May 4, 2015 11:11:21 AM Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

I can help after work. Can you provide some links to the pastes you put up? Please don't paste your connection file.

best regards,

Jason M

On Mon, May 4, 2015 at 8:14 AM, Rose notifications@github.com wrote:

Made a little progress with your suggestions below. I can now UPDATE a page, but not ADD a new page. I joined paste.bin (not sure I pasted properly and all that is needed). Does what I pasted help solve the mystery?? Need more files?? And, again, THANKS. R

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Saturday, May 2, 2015 4:32:22 PM Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

Ok here are the problems I see with the code.

  1. The form tag.
You are appending an array to the id. It needs to be like this: 1. The form uses the the POST method but you are checking for a GET. I think the reason its not working is because the id would be coming in empty every time and just post rather than update. # Must keep at $_GET as post does not work if(isset($_GET['id']) != '') { This needs to be post because the form submits the $opened['id'] in a hidden field at the bottom of your form. 1. Here's the update query you have: $q = "UPDATE pages SET user = $_POST[user], slug = '$_POST[slug]', title = '$title', label = '$label', header = '$header', body = '$body' WHERE id = $_GET [id]"; Everything looks good except the very last part. You need to remove the space between $_GET and [id] Please fix all these problems first and test it. If there is still problems we can drill down further and take a closer look, but the obvious problems need to be fixed first. Also it will be a lot easier to look at your code if you use http://pastebin.com/ and share all the files involved. I know bugged code can be extremely frustrating. Just keep at it like the rest of us and eventually you figure it out. :) Jason M On Fri, May 1, 2015 at 6:03 PM, Rose notifications@github.com wrote: > Shucks....I wish that was it. JasonMate mentioned that fix yesterday. > I > corrected it this morning....and it still didn't work. The problem is > definitely in the UPDATE though, because before I put that in, it > added > a > page just fine. Now....it doesn't update OR add a new page. > > — > Reply to this email directly or view it on GitHub > < https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-98264309> > . — Reply to this email directly or view it on GitHub . — Reply to this email directly or view it on GitHub < https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-98723747> .

— Reply to this email directly or view it on GitHub .

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-98752008 .

RosemaryRoss commented 9 years ago

Oh. http://pastebin.com/pBvW9JB8

http://pastebin.com/A663ZBQy

http://pastebin.com/HqSPpPcp

http://pastebin.com/sKbMnf6U

http://pastebin.com/qny3ZAAR

I wondered how this worked.

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Monday, May 4, 2015 11:31:49 AM Subject: Re: [Atom.CMS] Video 44 (#119)

If you posted the files on pastebin.com then I will need the links to each file you posted.

Like this: http://pastebin.com/ubgGNsED

On Mon, May 4, 2015 at 9:24 AM, Rose notifications@github.com wrote:

What do you need as links?? (sorry, ...new at this) I posted 5 files. I'm not sure what other files are needed.

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Monday, May 4, 2015 11:11:21 AM Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

I can help after work. Can you provide some links to the pastes you put up? Please don't paste your connection file.

best regards,

Jason M

On Mon, May 4, 2015 at 8:14 AM, Rose notifications@github.com wrote:

Made a little progress with your suggestions below. I can now UPDATE a page, but not ADD a new page. I joined paste.bin (not sure I pasted properly and all that is needed). Does what I pasted help solve the mystery?? Need more files?? And, again, THANKS. R

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Saturday, May 2, 2015 4:32:22 PM Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

Ok here are the problems I see with the code.

  1. The form tag.
You are appending an array to the id. It needs to be like this: 1. The form uses the the POST method but you are checking for a GET. I think the reason its not working is because the id would be coming in empty every time and just post rather than update. # Must keep at $_GET as post does not work if(isset($_GET['id']) != '') { This needs to be post because the form submits the $opened['id'] in a hidden field at the bottom of your form. 1. Here's the update query you have: $q = "UPDATE pages SET user = $_POST[user], slug = '$_POST[slug]', title = '$title', label = '$label', header = '$header', body = '$body' WHERE id = $_GET [id]"; Everything looks good except the very last part. You need to remove the space between $_GET and [id] Please fix all these problems first and test it. If there is still problems we can drill down further and take a closer look, but the obvious problems need to be fixed first. Also it will be a lot easier to look at your code if you use http://pastebin.com/ and share all the files involved. I know bugged code can be extremely frustrating. Just keep at it like the rest of us and eventually you figure it out. :) Jason M On Fri, May 1, 2015 at 6:03 PM, Rose notifications@github.com wrote: > Shucks....I wish that was it. JasonMate mentioned that fix yesterday. > I > corrected it this morning....and it still didn't work. The problem is > definitely in the UPDATE though, because before I put that in, it > added > a > page just fine. Now....it doesn't update OR add a new page. > > — > Reply to this email directly or view it on GitHub > < https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-98264309> > . — Reply to this email directly or view it on GitHub . — Reply to this email directly or view it on GitHub < https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-98723747> .

— Reply to this email directly or view it on GitHub .

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-98752008 .

— Reply to this email directly or view it on GitHub .

JasonMate commented 9 years ago

Hey Rose,

I just looked over your code, and I can't see any problems with the INSERT query you have. The only thing I found is on index.php line 139:

RosemaryRoss commented 9 years ago

No, I don’t have anything in queries.php yet.

The code does update. But won’t add a new page.

You guys are great to be able to look over code and spot glitches.

From: JasonMate [mailto:notifications@github.com] Sent: Monday, May 04, 2015 8:45 PM To: thedigicraft/Atom.CMS Cc: Rose Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

I just looked over your code, and I can't see any problems with the INSERT query you have. The only thing I found is on index.php line 139:

RosemaryRoss commented 9 years ago

I’ll copy the error message and show you tomorrow.

From: JasonMate [mailto:notifications@github.com] Sent: Monday, May 04, 2015 8:45 PM To: thedigicraft/Atom.CMS Cc: Rose Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

I just looked over your code, and I can't see any problems with the INSERT query you have. The only thing I found is on index.php line 139:

JasonMate commented 9 years ago

Do you have id set to auto increment in the pages table?

On Mon, May 4, 2015 at 7:50 PM, Rose notifications@github.com wrote:

I’ll copy the error message and show you tomorrow.

From: JasonMate [mailto:notifications@github.com] Sent: Monday, May 04, 2015 8:45 PM To: thedigicraft/Atom.CMS Cc: Rose Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

I just looked over your code, and I can't see any problems with the INSERT query you have. The only thing I found is on index.php line 139:

RosemaryRoss commented 9 years ago

Yes, id is set to auto increment.

This is the error message when trying to ADD a page:

Page could not be added because:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

UPDATE pages SET user = 4, slug = 'New Page Monday', title = 'New Page', label = 'New Page', header = 'New Page', body = '

trying to add a page ' WHERE id =

I'm user 4 in the user table.

Not knowing enough about code, and trying to learn, is what makes this difficult. I can't find the mistake because I don't totally understand all the code.

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Tuesday, May 5, 2015 7:46:22 AM Subject: Re: [Atom.CMS] Video 44 (#119)

Do you have id set to auto increment in the pages table?

On Mon, May 4, 2015 at 7:50 PM, Rose notifications@github.com wrote:

I’ll copy the error message and show you tomorrow.

From: JasonMate [mailto:notifications@github.com] Sent: Monday, May 04, 2015 8:45 PM To: thedigicraft/Atom.CMS Cc: Rose Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

I just looked over your code, and I can't see any problems with the INSERT query you have. The only thing I found is on index.php line 139:

— Reply to this email directly or view it on GitHub .

RosemaryRoss commented 9 years ago

If I switch the $q = "INSERT INTO pages with $q = "UPDATE pages (just reverse their position), I can then ADD a page, but you lose the ability to UPDATE a page. At this point, I think I have my code (or did before I switched them) exactly like the video.

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Saturday, May 2, 2015 4:32:22 PM Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

Ok here are the problems I see with the code.

  1. The form tag.
You are appending an array to the id. It needs to be like this: 1. The form uses the the POST method but you are checking for a GET. I think the reason its not working is because the id would be coming in empty every time and just post rather than update. # Must keep at $_GET as post does not work if(isset($_GET['id']) != '') { This needs to be post because the form submits the $opened['id'] in a hidden field at the bottom of your form. 1. Here's the update query you have: $q = "UPDATE pages SET user = $_POST[user], slug = '$_POST[slug]', title = '$title', label = '$label', header = '$header', body = '$body' WHERE id = $_GET [id]"; Everything looks good except the very last part. You need to remove the space between $_GET and [id] Please fix all these problems first and test it. If there is still problems we can drill down further and take a closer look, but the obvious problems need to be fixed first. Also it will be a lot easier to look at your code if you use http://pastebin.com/ and share all the files involved. I know bugged code can be extremely frustrating. Just keep at it like the rest of us and eventually you figure it out. :) Jason M On Fri, May 1, 2015 at 6:03 PM, Rose notifications@github.com wrote: > Shucks....I wish that was it. JasonMate mentioned that fix yesterday. I > corrected it this morning....and it still didn't work. The problem is > definitely in the UPDATE though, because before I put that in, it added a > page just fine. Now....it doesn't update OR add a new page. > > — > Reply to this email directly or view it on GitHub > https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-98264309 > . — Reply to this email directly or view it on GitHub .
JasonMate commented 9 years ago

Hey Rose,

That pretty much means that both queries are good. There is some type of logical error that I can't spot unless I go watch all the videos again. I know a lot of this code will be moved to queries.php eventually in the series.

I'm just shooting in the dark, but a guy in the comments on video 44 said he was having similar problems and this worked for him:

He replaced: if(isset($_POST['id']) != '') {

With: if(isset($_POST['id']) != 'NULL') {

It wouldn't hurt to try it and see.

Sorry couldn't help more :(

Jason M

On Tue, May 5, 2015 at 12:21 PM, Rose notifications@github.com wrote:

If I switch the $q = "INSERT INTO pages with $q = "UPDATE pages (just reverse their position), I can then ADD a page, but you lose the ability to UPDATE a page. At this point, I think I have my code (or did before I switched them) exactly like the video.

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Saturday, May 2, 2015 4:32:22 PM Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

Ok here are the problems I see with the code.

  1. The form tag.
You are appending an array to the id. It needs to be like this: 1. The form uses the the POST method but you are checking for a GET. I think the reason its not working is because the id would be coming in empty every time and just post rather than update. # Must keep at $_GET as post does not work if(isset($_GET['id']) != '') { This needs to be post because the form submits the $opened['id'] in a hidden field at the bottom of your form. 1. Here's the update query you have: $q = "UPDATE pages SET user = $_POST[user], slug = '$_POST[slug]', title = '$title', label = '$label', header = '$header', body = '$body' WHERE id = $_GET [id]"; Everything looks good except the very last part. You need to remove the space between $_GET and [id] Please fix all these problems first and test it. If there is still problems we can drill down further and take a closer look, but the obvious problems need to be fixed first. Also it will be a lot easier to look at your code if you use http://pastebin.com/ and share all the files involved. I know bugged code can be extremely frustrating. Just keep at it like the rest of us and eventually you figure it out. :) Jason M On Fri, May 1, 2015 at 6:03 PM, Rose notifications@github.com wrote: > Shucks....I wish that was it. JasonMate mentioned that fix yesterday. I > corrected it this morning....and it still didn't work. The problem is > definitely in the UPDATE though, because before I put that in, it added > a > page just fine. Now....it doesn't update OR add a new page. > > — > Reply to this email directly or view it on GitHub > < > https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-98264309> > > . — Reply to this email directly or view it on GitHub . — Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-99165632 .
RosemaryRoss commented 9 years ago

I’m going to give that a try, because it seems to me (you are right) that both queries work….just not together. So, my plan is first to try the recommended fix below. IF that doesn’t work (and it may not…who knows), THEN I’m going to put it back to a page will UPDATE, and I will just add a page manually through the database so I can move forward. Otherwise, I’m stuck on 44 with no further progress.

I sincerely DO appreciate your efforts. Learning this stuff via videos is SOoooooo freaking hard.

Thanks.

R

From: JasonMate [mailto:notifications@github.com] Sent: Tuesday, May 05, 2015 8:11 PM To: thedigicraft/Atom.CMS Cc: Rose Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

That pretty much means that both queries are good. There is some type of logical error that I can't spot unless I go watch all the videos again. I know a lot of this code will be moved to queries.php eventually in the series.

I'm just shooting in the dark, but a guy in the comments on video 44 said he was having similar problems and this worked for him:

He replaced: if(isset($_POST['id']) != '') {

With: if(isset($_POST['id']) != 'NULL') {

It wouldn't hurt to try it and see.

Sorry couldn't help more :(

Jason M

On Tue, May 5, 2015 at 12:21 PM, Rose notifications@github.com wrote:

If I switch the $q = "INSERT INTO pages with $q = "UPDATE pages (just reverse their position), I can then ADD a page, but you lose the ability to UPDATE a page. At this point, I think I have my code (or did before I switched them) exactly like the video.

----- Original Message -----

From: "JasonMate" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Saturday, May 2, 2015 4:32:22 PM Subject: Re: [Atom.CMS] Video 44 (#119)

Hey Rose,

Ok here are the problems I see with the code.

  1. The form tag.
You are appending an array to the id. It needs to be like this: 1. The form uses the the POST method but you are checking for a GET. I think the reason its not working is because the id would be coming in empty every time and just post rather than update. # Must keep at $_GET as post does not work if(isset($_GET['id']) != '') { This needs to be post because the form submits the $opened['id'] in a hidden field at the bottom of your form. 1. Here's the update query you have: $q = "UPDATE pages SET user = $_POST[user], slug = '$_POST[slug]', title = '$title', label = '$label', header = '$header', body = '$body' WHERE id = $_GET [id]"; Everything looks good except the very last part. You need to remove the space between $_GET and [id] Please fix all these problems first and test it. If there is still problems we can drill down further and take a closer look, but the obvious problems need to be fixed first. Also it will be a lot easier to look at your code if you use http://pastebin.com/ and share all the files involved. I know bugged code can be extremely frustrating. Just keep at it like the rest of us and eventually you figure it out. :) Jason M On Fri, May 1, 2015 at 6:03 PM, Rose notifications@github.com wrote: > Shucks....I wish that was it. JasonMate mentioned that fix yesterday. I > corrected it this morning....and it still didn't work. The problem is > definitely in the UPDATE though, because before I put that in, it added > a > page just fine. Now....it doesn't update OR add a new page. > > — > Reply to this email directly or view it on GitHub > < > https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-98264309> > > . — Reply to this email directly or view it on GitHub . — Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-99165632 .

— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/119#issuecomment-99267575 . https://github.com/notifications/beacon/ALeh6MnQUbYNKp4MntEUQgQo5Synsk3sks5oGVOWgaJpZM4EEV0X.gif

creptor commented 9 years ago

---sorry it doesn't fix this method the problem

creptor commented 9 years ago

o and you should always wrap the values (like: user=$asd) inside apostrophe to avoid missunderstanding of the values you input...... like for the email :P

Example: user='$_POST[user]'

PD: this should work, just tested with phpmyadmin.

RosemaryRoss commented 9 years ago

Thanks. I put '$_POST[user]' in. didn't make a difference though. So I took it back out as the video said user was numeric value. I'll try the next video and just manually ADD a page through the database....until I figure this out. Great mystery.

----- Original Message -----

From: "creptor" notifications@github.com To: "thedigicraft/Atom.CMS" Atom.CMS@noreply.github.com Cc: "Rose" rross117@comcast.net Sent: Tuesday, May 5, 2015 9:33:24 PM Subject: Re: [Atom.CMS] Video 44 (#119)

o and you should always wrap the values (like: user=$asd ) inside apostrophe to avoid missunderstanding of the values you input...... like for the email :P

Example: user='$_POST[user]'

— Reply to this email directly or view it on GitHub .

creptor commented 9 years ago

have you tried to input what you get (echoing the $q) into the phpmyadmin with sql method.... this gives and detailed error. Or at least i can understand them.(sometime I do this to find query errors)