<?php
include "../db/class.db.php";
class User {
private $iduser;
private $user;
private $pass;
private $dt;
public function User() {
echo "<br />";
echo "-= Class User =- <br />";
echo "Name: " . $this->user . "<br />";
echo "Pass: " . $this->pass;
}
}
// Simple sample
$con = new DB();
$sql = "SELECT * FROM user";
$con->query($sql);
$con->getRow();
echo $con->getField("user") . "<br /><br />";
// Connection already open (2 or more queries)
$sql = "SELECT pass FROM user";
$rs = new DB($con->getCon());
$rs->query($sql);
$rs->getRow();
echo "User: " . $con->getField("user") . "<br />";
echo "Pass: " . $rs->getField("pass") . "<br />";
echo "<br />";
// Making objects with result
$sql = "SELECT * FROM user";
$con->query($sql);
$users = array();
while ($user = $con->getRowAsObj("User"))
$users[] = $user;
?>
|