当前位置: 首页>>代码示例>>PHP>>正文


PHP mysql::executaSQL方法代码示例

本文整理汇总了PHP中mysql::executaSQL方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::executaSQL方法的具体用法?PHP mysql::executaSQL怎么用?PHP mysql::executaSQL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mysql的用法示例。


在下文中一共展示了mysql::executaSQL方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mysql

<?php

require_once 'classes/classe_bancodados.inc';
$bd = new mysql('localhost', 'root');
$bd->startTransaction();
$houveErro = false;
$bd->executaSQL("use cake;");
$execRet = $bd->executaSQL("insert into articles(title, body) values ('aluno 01', 'Rafael Pomar');");
if (!$execRet) {
    $houveErro = true;
}
$execRet = $bd->executaSQL("insert into articles(title, body) values ('aluno 02', 'Rafael garcia');");
if (!$execRet) {
    $houveErro = true;
}
$execRet = $bd->executaSQL("insert into articles(title, body) values ('aluno 03', 'carlos');");
if (!$execRet) {
    $houveErro = true;
}
$execRet = $bd->executaSQL("insert into articles(title, body) values ('aluno 04', 'Deise');");
if (!$execRet) {
    $houveErro = true;
}
if ($houveErro) {
    echo "houve um erro";
    $bd->ROLLBACK();
} else {
    echo "sucesso, vamos gravar";
    $bd->commit();
}
开发者ID:rafaelcorreargc,项目名称:sisnema-frameworks-php,代码行数:30,代码来源:exemplo_2_4.php

示例2: mysql

<?php

require_once 'classes/classe_bancodados.inc';
//class BD extends BancoDados{};
$bd = new mysql('localhost', 'root');
//$conn = $bd->GetConn();
$articles = $bd->executaSQL("SELECT * FROM cake.articles");
//var_dump($articles);
//die;
$line = '';
while ($obj = $articles->fetch_object()) {
    $line .= $obj->id;
    $line .= $obj->title;
    $line .= $obj->body;
    $line .= "<br>";
}
echo $line;
开发者ID:rpomar,项目名称:sisnema-frameworks-php,代码行数:17,代码来源:index.php

示例3: mysql

<?php

require_once 'classes/classe_bancodados.inc';
$bd = new mysql('localhost', 'root');
$articles = $bd->executaSQL("select * from cake.articles");
$line = '';
while ($obj = $articles->fetch_object()) {
    $line .= $obj->id;
    $line .= $obj->title;
    $line .= $obj->body;
    $line .= "<br>";
}
echo $line;
?>

开发者ID:rafaelcorreargc,项目名称:sisnema-frameworks-php,代码行数:14,代码来源:index.php

示例4: mysql

<?php

require_once 'classes/classe_bancodados.inc';
$bd = new mysql('localhost', 'root');
$bd->startTransaction();
$houveErro = false;
$bd->executaSQL("use cake;");
$execRet = $bd->executaSQL("insert into articles(title, body) values ('aluno 05', 'Rafael atrasado');");
if (!$execRet) {
    $houveErro = true;
}
$execRet = $bd->executaSQL("insert into articles(title, body) values ('aluno 06', 'Rafael sr.net');");
if (!$execRet) {
    $houveErro = true;
}
$execRet = $bd->executaSQL("insert into articles(title, body) values ('aluno 07', 'Carlos faster');");
if (!$execRet) {
    $houveErro = true;
}
$execRet = $bd->executaSQL("insert into articles(title, body) values ('aluno 08', 'Deise loka');");
if (!$execRet) {
    $houveErro = true;
}
if ($houveErro) {
    echo "Erro!";
    $bd->ROLLBACK();
} else {
    echo "Tudo OK!";
    $bd->commit();
}
//	echo $sql;
开发者ID:brasillphp,项目名称:aulas,代码行数:31,代码来源:exemplo_2_4.php

示例5: mysql

<?php

require_once 'classes/classe_bancodados.inc';
$bd = new mysql('localhost', 'root');
$bd->startTransaction();
$houveErro = false;
$bd->executaSQL("use cake;");
$execRet = $bd->executaSQL("INSERT INTO articles (title, body) VALUES ('Aluno 01', 'Rafael Pomar');");
if (!$execRet) {
    $houveErro = true;
}
$execRet = $bd->executaSQL("INSERT INTO articles (title, body) VALUES ('Aluno 02', 'Carlos');");
if (!$execRet) {
    $houveErro = true;
}
$execRet = $bd->executaSQL("INSERT INTO articles (title, body) VALUES ('Aluno 03', 'Rafael Garcia');");
if (!$execRet) {
    $houveErro = true;
}
$execRet = $bd->executaSQL("INSERT INTO articles (title, body) VALUES ('Aluno 04', 'Deise');");
if (!$execRet) {
    $houveErro = true;
}
if ($houveErro) {
    $bd->ROLLBACK();
} else {
    $bd->commit();
}
开发者ID:rpomar,项目名称:sisnema-frameworks-php,代码行数:28,代码来源:exemplo_2_4.php


注:本文中的mysql::executaSQL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。