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 - How can reloading the page after DB updating
  FAQ FAQ  Forum Search   Register Register  Login Login

How can reloading the page after DB updating

 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: How can reloading the page after DB updating
    Posted: 07 Sep 2016 at 23:26
Dear openElement,

I go just step by step with your help. Thanks.

I want to figure out how reload the page after DB updating through submit form?
That means I want to change the page with updating DB value?

DJ
Back to Top
Dmit OE View Drop Down
Admin Group
Admin Group
Avatar

Joined: 31 Mai 2012
Status: Offline
Points: 5086
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dmit OE Quote  Post ReplyReply Direct Link To This Post Posted: 08 Sep 2016 at 11:55
Hi,

Do you use the Send Form element? Can you use the same page ("Active Page" in the "tree" of the link configuration dialog), so that it loads the page and passes the data to it, and use PHP scripts (or include your existing PHP script) to process it?
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: 08 Sep 2016 at 16:07
1. Yes, I use Submit Form element.
2. I use php script directly for instance: LOCAL: test/manual_scripting/update.php



//update.php
<?php
$db = new PDO('sqlite:../../Data/Local_previs_DB/illu.db');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$data = array();
    $data[0] = $_POST['WE50467f8358'];
    $data[1] = $_POST['WEd7e0a2dcba'];
    $data[2] = $_POST['WE778b0b2dec'];
   
$stmt = array();

for ($i=0; $i<=2; $i++) {
    $j = $i + 1;
    $stmt[$i] = $db->prepare("UPDATE test_table SET name=(:name) WHERE id='$j'");
    $stmt[$i]->bindParam(':name', $data[$i]);
    $stmt[$i]->execute();
}
?>
Could you let me know how I can update DB using the same page (Current Page) and php scripts both?


Edited by djju1029 - 08 Sep 2016 at 17:05
Back to Top
Dmit OE View Drop Down
Admin Group
Admin Group
Avatar

Joined: 31 Mai 2012
Status: Offline
Points: 5086
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dmit OE Quote  Post ReplyReply Direct Link To This Post Posted: 09 Sep 2016 at 02:36
It's hard to say without having your project. Add something like this to a Code Block Source type PHP position StartDocument on your page:

if (isset($_POST['WE50467f8358'])) {
  require_once ('test/manual_scripting/update.php'); // check the path; this will include+execute your script
}

Then use the link to the same page (ex. LOCAL: #) in the Send Form configuration, rather than your script. And make sure you have PHP code that gets values from DB on this page - I think you already have it in place.
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,016 seconds.