BullGuard Antivirus Sale - 60% Off with openElement !
Forum Home Forum Home >

openElement

> Dynamic OE - Databases, etc
  New Posts New Posts RSS Feed - No DB UPDATE on hosting server
  FAQ FAQ  Forum Search   Register Register  Login Login

No DB UPDATE on hosting server

 Post Reply Post Reply
Author
Message
djju1029 View Drop Down
Senior Member
Senior Member
Avatar

Joined: Aug 02 2016
Location: the US
Status: Offline
Points: 126
Post Options Post Options   Thanks (0) Thanks(0)   Quote djju1029 Quote  Post ReplyReply Direct Link To This Post Topic: No DB UPDATE on hosting server
    Posted: Oct 27 2016 at 8:13pm
Dear OE Team,

Very Urgent issue,

I tested all functions on LocalHost test evironment and copied by FTP client to my webserver in Raspberry Pi machine.

But after copying source, only DB UPDATE function does not work.
The other function such as OPEN, SELECT DB work but UPDATE didn't.
Still, all functions are working on LocalHost by OE 1.56 and sources are exactly same.

Do you know what problem is on mine?


Edited by djju1029 - Dec 07 2016 at 2:32pm
Back to Top
Dmit OE View Drop Down
Admin Group
Admin Group


Joined: May 31 2012
Status: Offline
Points: 5283
Post Options Post Options   Thanks (1) Thanks(1)   Quote Dmit OE Quote  Post ReplyReply Direct Link To This Post Posted: Oct 27 2016 at 9:12pm
Does it show any error message? Can you try to write(or copy from some tutorial) a small script that updates a table, and see what happens?
Back to Top
Dmit OE View Drop Down
Admin Group
Admin Group


Joined: May 31 2012
Status: Offline
Points: 5283
Post Options Post Options   Thanks (1) Thanks(1)   Quote Dmit OE Quote  Post ReplyReply Direct Link To This Post Posted: Oct 27 2016 at 9:12pm
P.S. Give your code's piece that contains UPDATE
Back to Top
djju1029 View Drop Down
Senior Member
Senior Member
Avatar

Joined: Aug 02 2016
Location: the US
Status: Offline
Points: 126
Post Options Post Options   Thanks (0) Thanks(0)   Quote djju1029 Quote  Post ReplyReply Direct Link To This Post Posted: Oct 31 2016 at 11:25am
Thanks for feedback, Dmit OE.

No error message, just no updating and last value remained.
Back to Top
djju1029 View Drop Down
Senior Member
Senior Member
Avatar

Joined: Aug 02 2016
Location: the US
Status: Offline
Points: 126
Post Options Post Options   Thanks (0) Thanks(0)   Quote djju1029 Quote  Post ReplyReply Direct Link To This Post Posted: Oct 31 2016 at 11:31am
Here is the sample code. (update.php - This code works in LocalHost, not in Raspberry Pi)

<?php
//registerng by form
$data = array();
$data[0] = $_POST['WE50467f8358'];
$data[1] = $_POST['WEd7e0a2dcba'];
$data[2] = $_POST['WE778b0b2dec'];
  
//open DB
$db = new PDO('sqlite:../../Data/Local_previs_DB/illu.db');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 
//read DB
$readstmt = $db->prepare("SELECT * FROM test_table");
$readstmt->execute();
$read = $readstmt->fetchAll(PDO::FETCH_ASSOC);

$tempid = array();
for ($i=0; $i<=2; $i++) {
if ($data[$i] !== $read[$i]['name']) {
$tempid[$i] = $read[$i]['id'];
}
}

//update DB
$updatestmt = array();
for ($ii=0; $ii<=2; $ii++) {
  if ($tempid[$ii] !== NULL) {
  $updatestmt[$ii] = $db->prepare("UPDATE test_table SET name=(:name) WHERE id='$tempid[$ii]'");
  $updatestmt[$ii]->bindParam(':name', $data[$ii]);
  $updatestmt[$ii]->execute();
  }
}


header('Location: ./test-BlankLayer.php');  
?>


Edited by djju1029 - Oct 31 2016 at 11:46am
Back to Top
djju1029 View Drop Down
Senior Member
Senior Member
Avatar

Joined: Aug 02 2016
Location: the US
Status: Offline
Points: 126
Post Options Post Options   Thanks (0) Thanks(0)   Quote djju1029 Quote  Post ReplyReply Direct Link To This Post Posted: Oct 31 2016 at 11:54am
I got this message.

This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying.
Back to Top
djju1029 View Drop Down
Senior Member
Senior Member
Avatar

Joined: Aug 02 2016
Location: the US
Status: Offline
Points: 126
Post Options Post Options   Thanks (0) Thanks(0)   Quote djju1029 Quote  Post ReplyReply Direct Link To This Post Posted: Oct 31 2016 at 1:06pm
I resolved this issue with change the mode as following:

pi@raspberrypi:~/Project/NMU_mockup/Data/Local_previs_DB $ chmod 777 illu.db
pi@raspberrypi:~/Project/NMU_mockup/Data/Local_previs_DB $ chmod 777 oedb.db

Thank you for your support!
Back to Top
Dmit OE View Drop Down
Admin Group
Admin Group


Joined: May 31 2012
Status: Offline
Points: 5283
Post Options Post Options   Thanks (1) Thanks(1)   Quote Dmit OE Quote  Post ReplyReply Direct Link To This Post Posted: Oct 31 2016 at 4:17pm
So access permissions for DB files were insufficient.. Ok
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.