<html> <head> <title>fpBatis Create Example</title> </head> <body> <p> <a href="list_example.php">List Example</a><br/> <a href="create_example.php">Create Example</a> </p> <?php require 'fpbatis.php'; $fpBatis = new FPBatis('sqlMap.xml'); $fpBatis->setDebug(true); $id = $_GET['id']; if ($_GET['edit'] == 'country') { $country = $fpBatis->doSelect('Countries.select', $id); $country = $country[0]; } else { if ($_GET['edit'] == 'state') { $state = $fpBatis->doSelect('States.select', $id); $state = $state[0]; } else { if ($_GET['edit'] == 'city') { $city = $fpBatis->doSelect('Cities.select', $id); $city = $city[0]; } else { if ($_GET['save'] == 'country') { $country = $fpBatis->doSaveForm('Countries'); $id = $country['id']; echo 'Saved country with doSaveForm: '; print_r($country);
<?php require 'fpbatis.php'; $fpBatis = new FPBatis('sqlMap.xml'); $fpBatis->setDebug(true); $nestings = $fpBatis->doSelect('Comments.selectByParent', array('objId' => 1)); function recurseTree($nestArry) { if (is_array($nestArry)) { echo "<div>\n"; foreach ($nestArry as $nest) { echo "<div>Name: " . $nest['comment'] . "</div>\n"; echo "<div style='padding-left: 50px;'>Subcomments: \n"; recurseTree($nest['subcomments']); echo "</div>\n"; } echo "</div>\n"; } } recurseTree($nestings);
<html> <head> <title>fpBatis List Example</title> </head> <body> <p> <a href="list_example.php">List Example</a><br/> <a href="create_example.php">Create Example</a> </p> <?php require 'fpbatis.php'; $fpBatis = new FPBatis('sqlMap.xml'); $fpBatis->setDebug(true); $id = $_GET['id']; if ($_GET['delete'] == 'country') { $fpBatis->doDelete('Countries.delete', array('id' => $id)); } else { if ($_GET['delete'] == 'state') { $fpBatis->doDelete('States.delete', array('id' => $id)); } else { if ($_GET['delete'] == 'city') { $fpBatis->doDelete('Cities.delete', array('id' => $id)); } } } $params = array(); $params['sort'] = 'country'; $params['sortDir'] = 'DESC'; $params['idList'] = array(1, 2); $allCountries = $fpBatis->doSelect('Countries.selectAll', $params); echo '<ul>';