#1 Re: Topics related with App Builder » Modify the Report Sample App to include functions (Add, Edit, Delete)? » 2015-08-25 22:16:21

CIS

Okay, i have created from scratch these 5 PHP files in Visual Studio Code and placed them in the folder directory of Report where "data.php" is located.

File #1 (Config.php):

<?php
$query=mysql_connect("localhost","root","");
mysql_select_db("cis_report_demo",$query);
?>

File #2 (Add.php):

<html>
<body>
<?php
include('config.php');
if(isset($_POST['submit']))
{
$name=mysql_real_escape_string($_POST['name']);
$age=mysql_real_escape_string($_POST['age']);
$query1=mysql_query("insert into addd values('','$name','$age')");
echo "insert into addd values('','$name','$age')";
if($query1)
{
header("location:list.php");
}
}
?>
<fieldset style="width:300px;">
<form method="post" action="">
Name: <input type="text" name="name"><br>
Age: <input type="text" name="age"><br>
<br>
<input type="submit" name="submit">
</form>
</fieldset>
</body>
</html>

File #3 (List.php):

<html>
<body>
<?php
include('config.php');
$query1=mysql_query("select id, name, age from addd");
echo "<table><tr><td>Name</td><td>Age</td><td></td><td></td>";
while($query2=mysql_fetch_array($query1))
{
echo "<tr><td>".$query2['name']."</td>";
echo "<td>".$query2['age']."</td>";
echo "<td><a href='edit.php?id=".$query2['id']."'>Edit</a></td>";
echo "<td><a href='delete.php?id=".$query2['id']."'>x</a></td><tr>";
}
?>
</ol>
</table>
</body>
</html>

File #4 (Edit.php):

<html>
<body>
<?php
include('config.php');
if(isset($_GET['id']))
{
$id=$_GET['id'];
if(isset($_POST['submit']))
{
$name=$_POST['name'];
$age=$_POST['age'];
$query3=mysql_query("update addd set name='$name', age='$age' where id='$id'");
if($query3)
{
header('location:list.php');
}
}
$query1=mysql_query("select * from addd where id='$id'");
$query2=mysql_fetch_array($query1);
?>
<form method="post" action="">
Name:<input type="text" name="name" value="<?php echo $query2['name']; ?>" /><br />
Age:<input type="text" name="age" value="<?php echo $query2['age']; ?>" /><br /><br />
<br />
<input type="submit" name="submit" value="update" />
</form>
<?php
}
?>
</body>
</html>

File #5 (Delete.php):

<html>
<body>
<?php
include('config.php');
if(isset($_GET['id']))
{
$id=$_GET['id'];
$query1=mysql_query("delete from addd where id='$id'");
if($query1)
{
header('location:list.php');
}
}
?>
</body>
</html>

With that in mind, how can i incorporate all this code (5 PHP files) that i have created from scratch into the Report app sample in App Builder via a detailed step by step instruction from you. I have installed fully the MySQL Server 5.7.8 and all of its associated products such as Workbench 6.3.4,  Notifier 1.1.16 and so forth

#2 Re: Topics related with App Builder » Modify the Report Sample App to include functions (Add, Edit, Delete)? » 2015-08-25 19:13:05

CIS

Hello,

Yes i have extensively played with all 57 app samples in the App Builder including Report, Report2, Report3 and Report4 as you suggested. In fact, i am very confused with your latest message about "SimpleGet". In fact i have modified the code in the sample app "Report" to this:

InputBox "Edit/Modify" "Save|Delete" "" "info" "StrReplace [Record.ID] [Record.Name] [Sport]"
HttpExecute "app/files/data.php"
SimplePost "app/files/data.php" "Record.ID:InputBox" "[Report1.Query]"
SimpleGet "app/files/data.json"

What i really would like is to be able to allow the end user to modify (Add, Edit, and Delete) specific records locally (http://127.0.0.1:9999) from the "data.php" and "data.json" files in addition to what the Report sample app currently does already, which is the ability to retrieve certain records from the "data.php" and "data.json" files via the search query after it has been compiled and run. After i get that working locally first and fully functional, then i will connect it to an MySQL database in the Microsoft Azure Cloud via their "Mobile Services" feature. I can and have already compiled and ported the Report sample app to an Xcode project via Apache Cordova CLI where it works locally as a native iOS platform via the simulator just fine so far.

#3 Topics related with App Builder » Modify the Report Sample App to include functions (Add, Edit, Delete)? » 2015-08-24 19:18:39

CIS
Replies: 7

Is it possible and can you please modify the sample app "Report" to include these functions (Add, Edit, and Delete) specific records from the "data.php" and "data.json" files after the app has been compiled and run? I want the end user to be able to modify (Add, Edit, and Delete) specific records from the "data.php" and "data.json" files in addition to what it currently does already, which is the ability to retrieve certain records from the "data.php" and "data.json" files via the search query after it has been compiled and run.

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.