Print Page | Close Window

No DB UPDATE on hosting server

Printed From: openElement Website
Category:

openElement


Forum Name: Dynamic OE - Databases, etc
Forum Description: openElement's database management system and Element Packs
URL: https://forums.openelement.uk/en/forum_posts.asp?TID=877
Printed Date: Mar 28 2024 at 6:23pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: No DB UPDATE on hosting server
Posted By: djju1029
Subject: No DB UPDATE on hosting server
Date 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?



Replies:
Posted By: Dmit OE
Date 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?


Posted By: Dmit OE
Date Posted: Oct 27 2016 at 9:12pm
P.S. Give your code's piece that contains UPDATE


Posted By: djju1029
Date Posted: Oct 31 2016 at 11:25am
Thanks for feedback, Dmit OE.

No error message, just no updating and last value remained.


Posted By: djju1029
Date 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');  
?>


Posted By: djju1029
Date 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.


Posted By: djju1029
Date 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!


Posted By: Dmit OE
Date Posted: Oct 31 2016 at 4:17pm
So access permissions for DB files were insufficient.. Ok



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net