thedigicraft / Atom.CMS

Atom.CMS
56 stars 52 forks source link

The placeholder is not displaying correct value (Part - 65) #234

Closed v917 closed 7 years ago

v917 commented 7 years ago

Hi, @creptor actually the label textboxes in setting.php are not displaying the text which is in database, instead it is displaying Label. Please Help.

settings: https://pastebin.com/npgQdZrA queries.php: https://pastebin.com/7dRuvqgB Label problem.docx

v917 commented 7 years ago

ok, problem solved.

creptor commented 7 years ago

Sorry for not being able to attend your issue, I was too busy with the university.

creptor commented 7 years ago

😢

v917 commented 7 years ago

ohh its totally fine. Don't be sad

v917 commented 7 years ago

@creptor but now I am having another problem that, it is showing the message "Setting was updated" but it is not actually updating it. So, whenever you'll be free then please resolve my issue. Till then I am moving forward to next video. queries.php: https://pastebin.com/PciCyMKi settings: https://pastebin.com/Yn37iXGN Doc1.docx

creptor commented 7 years ago

I think that this:

$q = "UPDATE settings SET id = '$_POST[id]', label = '$label', value = '$value' WHERE id = '$_POST[openedid]'";

Should be:

$q = "UPDATE settings SET id = '$_POST[id]', label = '$label', value = '$value' WHERE id = '$_POST[id]'";
v917 commented 7 years ago

But I have used <input type="hidden" name="openedid" vaule="<?php echo $opened['id']; ?>" /> in settings.php, that is why it is '$_POST[openedid]'

creptor commented 7 years ago

Try changing this:

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

With:

if(isset($_POST['openedid'])&&$_POST['openedid']!='') {
v917 commented 7 years ago

No it is not working. See here:

image

And sorry for disturbing you in your busy schedule.

v917 commented 7 years ago

Now, I am having similar problem in navigation link ( part - 85) as well. It is also showing updating message but not actually updating it. image

v917 commented 7 years ago

I am not able to move forward now.😢 Please Help @creptor if you are free.

creptor commented 7 years ago

Please add this to the top of the file (inside setup.php would do fine) to try to find an error:

error_reporting(E_ALL);
ini_set("display_errors", 1);

If there's any error, it should be output as text. Check the console, the might be found behind elements with styles.

v917 commented 7 years ago

Nothing happened 😢

image

creptor commented 7 years ago

Can you take a photo of the database structure? To find out if the query is wrong...

v917 commented 7 years ago

DatabaseScreenshots.docx Check it Now

v917 commented 7 years ago

db.docx

If you need this one as well then please check.

pages and users link are updating the page and user respectively, but navigation and settings are creating the problem, don't know why

creptor commented 7 years ago

can you please put the query for the pages and users here?

creptor commented 7 years ago

Also you could try with this query: ´´´ $q = 'UPDATE settings SET id = '.$_POST['id'].', label = '.$label.', value = '.$value.' WHERE id = '.$_POST['openedid']; ´´´

v917 commented 7 years ago

After changing what you said to do, this happened: image

v917 commented 7 years ago

And queries for pages and users are: https://pastebin.com/WK6Nj3Pn

v917 commented 7 years ago

I want to ask one thing that: <input type="hidden" name="openedid" vaule="<?php echo $opened['id']; ?>" />

$q = 'UPDATE settings SET id = '.$_POST['id'].', label = '.$label.', value = '.$value.' WHERE id = '.$_POST['openedid'];;

here in input tag openedid is the name and and in the query i am searching id = '$_POST[openedid]', So is it correct?

creptor commented 7 years ago

Try changing the query to this:

$q = 'UPDATE settings SET id = `'.$_POST['id'].'`, label = `'.$label.'`, value = `'.$value.'` WHERE id = `'.$_GET['id'].'`';

The $_POST['openedid'] is not being set correctly, so this will fall back to the id sent by the URI.

v917 commented 7 years ago

ok. Wait

creptor commented 7 years ago

here in input tag openedid is the name and and in the query i am searching id = '$_POST[openedid]', So is it correct?

Could you please rephrase that, I didn't understand 😢 .

v917 commented 7 years ago

Nothing happened again

image

creptor commented 7 years ago

Sorry, I think it was the other way around, try this:

$q = "UPDATE settings SET `id` = '".$_POST['id']."', ´label´ = '".$label."', ´value´ = '".$value."' WHERE ´id´='".$_GET['id']."'";
v917 commented 7 years ago

o/p:

image

creptor commented 7 years ago

can you check if the input that is hidden with the value ´openedid´ has the same value as the id one?

It can be done with the developer console

v917 commented 7 years ago

queries.php https://pastebin.com/RG0FPDB3 settings.php https://pastebin.com/gNxzGWRx pages.php https://pastebin.com/Q2iuw2Sq

v917 commented 7 years ago

ok, wait.

v917 commented 7 years ago

yes @creptor the input that is hidden with the value ´openedid´ is same as the id.

creptor commented 7 years ago

This might be the one, it looks similar to the above one, but I was using the Latin keyboard, so the symbols where invalid on US machines 🤦‍♂️ , check if it now works:

$q = "UPDATE settings SET `id` = '".$_POST['id']."', ´label´ = '".$label."', ´value´ = '".$value."' WHERE ´id´='".$_POST['openedid']."'";

If it doesn't work, try to place the input openedid before the submit button......

v917 commented 7 years ago

ok wait

v917 commented 7 years ago

no, again... same error...

could you please insert this query in queries.php because I think it's again your latin keyboard.

v917 commented 7 years ago

Is ´ correct ? because i have not seen ´ before.. Is it coming from your latin keyboard or you actually wanted to use this?

creptor commented 7 years ago

.-. ok this should be correct (I actually copied the symbol so.... yea):

$q = "UPDATE settings SET `id` = '".$_POST['id']."', `label` = '".$label."', `value` = '".$value."' WHERE `id`='".$_POST['openedid']."'";

Is ´ correct ? because i have not seen ´ before.. Is it coming from your latin keyborad or you actually wanted to use this?

Yea, that thing is confusing as fuck if you want to use it 👎


Note: After this, the problem should be elsewhere if it persists.

v917 commented 7 years ago

but this query is same as you gave before

v917 commented 7 years ago

ok leave 😢. And thank you so much for your help. Really thanks a lot.

creptor commented 7 years ago

that's the thing, nothing that I have found in your script was wrong, so you need to patch the errors or better called 'inconsistencies' to see if it starts working. If I'm not mistaken you should use the symbol ``` for enclosing table names, so there's that.

For example, instead of:

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

You should actually use:

if(isset($_POST['id'])&&$_POST['id']!='') {
creptor commented 7 years ago

Wait, I can actually create another code to make it work, but it will be different. I use other things that are more.... advanced? any way, I can't explain to you how the code will work that's the catch, but it would be basically the same thing and it should work.

creptor commented 7 years ago

I will make it tomorrow if you tell me the credentials that you're using for the database:

Example: user: root, password: ,host: (localhost?),port: (3306?)

v917 commented 7 years ago

You have told me to use if(isset($_POST['id'])&&$_POST['id']!='') before but it didn't work. And I told you about that. And thanks for doing so much for me.

v917 commented 7 years ago

ok wait.

v917 commented 7 years ago

user: Dev password: password1 host: localhost port: 80

Is that what you are asking?

creptor commented 7 years ago

I need the information of the database, port 80 is used for web interface.

creptor commented 7 years ago

what you have inside of the file database.php (or connection.php), if you want you can email it to me to keep it secret... this is my email: creptor@live.com

v917 commented 7 years ago

ok

v917 commented 7 years ago

I have mailed you. Please tell me if i have send you exactly what you are asking or not.

creptor commented 7 years ago

yes it's correct 👍 I'll email you the solution when I finish it 😋

v917 commented 7 years ago

ok, Thank you so much in advance