Last active
December 12, 2015 06:29
-
-
Save rodro12/4730005 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php define( ‘FM_HOST’, ‘127.0.0.1’ ); | |
define( ‘FM_FILE’, ‘Product Catalog’ ); | |
define( ‘FM_USER’, ‘esmith’ ); | |
define( ‘FM_PASS’, ‘m4rg0t’ ); | |
require_once (‘FileMaker.php’); $fm = new FileMaker(FM_FILE, FM_HOST, FM_USER, FM_PASS); | |
if(isset($_GET[‘search’]) and $_GET[‘search’] != ‘’) { | |
$search = $_GET[‘search’]; $request = $fm->newFindCommand(‘Product’);ö. $request->addFindCriterion(‘Name’, $search); | |
} else { $search = ‘’; | |
$request = $fm->newFindAllCommand(‘Product’); } | |
if(isset($_GET[‘sortby’]) and $_GET[‘sortby’] != ‘’) { $request->addSortRule($_GET[‘sortby’], 1); | |
} | |
$result = $request->execute(); $records = $result->getRecords(); $rows = ‘’; foreach ($records as $record) { | |
$rows .= ‘<tr>’; $rows .= ‘<td><a href=”07_06.php?recid=’.$record->getRecordId().’”> edit</a></td>’; $rows .= ‘<td>’.$record->getField(‘ID’).’</td>’; $rows .= ‘<td>’.$record->getField(‘Name’).’</td>’; $rows .= ‘<td>’.$record->getField(‘Model Number’).’</td>’; $rows .= ‘<td>’.$record->getField(‘Price’).’</td>’; $rows .= ‘<td>’.$record->getField(‘Created At’).’</td>’; $rows .= ‘<td>’.$record->getField(‘Created By’).’</td>’; $rows .= ‘<td><a href=”07_04.php?recid=’.$record->getRecordId().’”> delete</a></td>’; $rows .= ‘</tr>’; | |
} ?> <html> | |
<head> <title>07_05</title> | |
</head> <body> | |
<form action=”07_05.php” method=”get”> <p> | |
Product Name Search: <input type=”text” name=”search” /> <input type=”submit” value=”Go” /> | |
</p> </form> | |
<table border=”1”> <tr> | |
<th>Edit</th> <th><a href=”07_05.php?search=<?php <th><a href=”07_05.php?search=<?php Name</a></th> <th><a href=”07_05.php?search=<?php Model Number</a></th> <th><a href=”07_05.php?search=<?php Price</a></th> <th><a href=”07_05.php?search=<?php Created At</a></th> <th><a href=”07_05.php?search=<?php Created By</a></th> <th>Delete</th> | |
echo $search ?>&sortby=ID”>ID</a></th> echo $search ?>&sortby=Name”> | |
echo $search ?>&sortby=Model+Number”> echo $search ?>&sortby=Price”> echo $search ?>&sortby=Created+At”> echo $search ?>&sortby=Created+By”> | |
</tr> | |
<?php echo $rows; ?> </table> | |
</body> </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment