當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。