<h1>Just 2 tests to uderstand how to use the cass PhpUtils</h1>
<?php
require_once("PhpUtils.php");
$link_id = mysql_connect("localhost", "remoteuser", "remotepswd");
mysql_select_db("mysql");
echo "<fieldset>";
echo "<legend><b>PhpUtils::getResultCounter</b></legend>";
$code = <<<CODE
\$sql = "SELECT count(*) as total_rows from user";
echo PhpUtils::getResultCounter(mysql_query(\$sql));
CODE;
echo nl2br($code);
echo "</fieldset>";
echo "<hr />";
echo "<fieldset>";
echo "<legend><b>PhpUtils::getObjectsFromResults</b></legend>";
$code = <<<CODE
require_once("DbMySql_initializer.php");
class User extends DbMySql_initializer
{
public \$Host;
public \$User;
};
\$sql = "SELECT * FROM user";
\$els = PhpUtils::getObjectsFromResults(mysql_query(\$sql), "User");
foreach(\$els as \$user)
{
echo \$user->User;
echo "<br />";
}
CODE;
echo nl2br($code);
echo "</fieldset>";
echo "<hr />";
?>
|