本文整理汇总了PHP中Conexao::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Conexao::set方法的具体用法?PHP Conexao::set怎么用?PHP Conexao::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conexao
的用法示例。
在下文中一共展示了Conexao::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Conexao
<?php
include 'classes/Conexao.php';
$connect = new Conexao();
$sql_current = "SELECT * FROM autonomo.estado ORDER BY uf";
$connect->set('sql', $sql_current);
$connect->conectar();
$newQuery = $connect->executar();
$num = mysql_num_rows($newQuery);
for ($i = 0; $i < $num; $i++) {
$dados = mysql_fetch_array($newQuery);
$arrEstados[$dados['uf']] = $dados['uf'];
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>autonomo.com</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#ajax_form').validate({
rules: {
id_tipo_usuario: { required: true },
示例2: Conexao
<?php
ini_set('display_errors', true);
/**
* php por testar a conexao com o banco de dados
*/
include 'Conexao.php';
#instanciando o objeto
$connect = new Conexao();
$connect->set('sql', 'SELECT * FROM usuario S');
$connect->conectar();
echo $connect->selecionarDB();
echo 'Foram encontrados: ' . mysql_num_rows($connect->executar()) . ' Usuarios em seu banco de dados';
?>