BullGuard Antivirus Sale - 60% Off with openElement !
Forum openElement Homepage
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: 02 Août 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: 27 Oct 2016 at 21:13
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 - 07 Dec 2016 at 15:32
Back to Top
Dmit OE View Drop Down
Admin Group
Admin Group
Avatar

Joined: 31 Mai 2012
Status: Offline
Points: 5016
Post Options Post Options   Thanks (1) Thanks(1)   Quote Dmit OE Quote  Post ReplyReply Direct Link To This Post Posted: 27 Oct 2016 at 22:12
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
Avatar

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

Joined: 02 Août 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: 31 Oct 2016 at 12:25
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: 02 Août 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: 31 Oct 2016 at 12:31
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 - 31 Oct 2016 at 12:46
Back to Top
djju1029 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 02 Août 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: 31 Oct 2016 at 12:54
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: 02 Août 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: 31 Oct 2016 at 14:06
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
Avatar

Joined: 31 Mai 2012
Status: Offline
Points: 5016
Post Options Post Options   Thanks (1) Thanks(1)   Quote Dmit OE Quote  Post ReplyReply Direct Link To This Post Posted: 31 Oct 2016 at 17:17
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 10.11
Copyright ©2001-2012 Web Wiz Ltd.

This page was generated in 0,027 seconds.