本文整理汇总了PHP中SqlQuery::mysql_connect方法的典型用法代码示例。如果您正苦于以下问题:PHP SqlQuery::mysql_connect方法的具体用法?PHP SqlQuery::mysql_connect怎么用?PHP SqlQuery::mysql_connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlQuery
的用法示例。
在下文中一共展示了SqlQuery::mysql_connect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: construct
/**
* Implementation of printf() behavior for constructor.
*/
private function construct($format, $argv)
{
$this->con = SqlQuery::mysql_connect();
// Apply mysql_real_escape_string() on all format args
foreach ($argv as &$arg) {
$arg = mysql_real_escape_string($arg, $this->con);
}
$this->query_string = vsprintf($format, $argv);
$this->result = SqlQuery::mysql_query($this->query_string, $this->con);
}
示例2: purge_test_database
/**
* Removes all data from the database. Meant to be called before
* each time we run automatic tests on the site so we get a
* predictable test fixture.
*/
public static function purge_test_database()
{
$con = SqlQuery::mysql_connect();
$all_tables = array("Users", "LoginTokens", "Projects", "Tasks", "Sizes", "Names", "Remaining");
foreach ($all_tables as $table) {
SqlQuery::mysql_query("DELETE FROM {$table}", $con);
$affected_rows_count = mysql_affected_rows($con);
echo "Deleted {$affected_rows_count} from {$table}\n";
}
SqlQuery::mysql_close($con);
}