Print Page | Close Window

No DB UPDATE on hosting server

Printed From: Forum openElement
Category:

openElement


Forum Name: Dynamic OE - Databases, etc
Forum Description: openElement's database management system and Element Packs
URL: http://forum.openelement.com/fr/forum_posts.asp?TID=877
Printed Date: 21 Feb 2019 at 13:44
Software Version: Web Wiz Forums 10.11 - http://www.webwizforums.com


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



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


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


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

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


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


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


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


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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 10.11 - http://www.webwizforums.com
Copyright ©2001-2012 Web Wiz Ltd. - http://www.webwiz.co.uk