class Contact
{
public $name;
public $address;
public $city;
public $state;
public function __construct($name, $address, $city, $state)
{
$this->name = $name;
$this->address = $address;
$this->city = $city;
$this->state = $state;
}
}
set_include_path(get_include_path() . PATH_SEPARATOR . './PHPLinq/');
include_once('PHPLinq/LinqToObjects.php');
include_once('contact.php');
// Create data source
$contacts = array(
new Contact("Aamir Hasan", "523 Fake Address", "Cincinnati", "OH"),
new Contact("awais", "0991 Another St.", "L.A.", "CA"),
new Contact("amir", "7912 Bs Blvd.", "L.A.", "CA"),
new Contact("MVP", "1092 Dugg St.", "San Francisco", "CA"),
new Contact("amazing", "821 Easy St.", "Indianapolis", "IN"),
new Contact("hacker", "9012 Good St.", "Cincinnati", "OH"),
new Contact("asp.net", "2459 Loser Dr.", "East Boofoo", "IN")
);
$result =
from('$contact')->in($contacts)
->where('$contact =>
$contact->state == "' . $_REQUEST['state'] . '"')
->orderBy('$contact => $contact->name')
->select('$contact');
<div id="main">
<table>
<thead>
<tr>
<td>Name</td>
<td>Address</td>
<td>City</td>
<td>State</td>
</tr>
</thead>
<tbody>
<? for($i = 0; $i < count($result); $i++): ?>
<tr class="datarow<?= ($i & 1)?>">
<td><?= $result[$i]->name ?></td>
<td><?= $result[$i]->address ?></td>
<td><?= $result[$i]->city ?></td>
<td><?= $result[$i]->state ?></td>
</tr>
<? endfor; ?>
</tbody>
</table>
</div>
Author:
Aamir Hasan औथोर:
आमिर हसन أثر
أمير حسن .
b0d5d3ba-93ca-4378-97f5-2acd36862ce9|0|.0
ALL, PHP
php