本文整理汇总了PHP中executeSql函数的典型用法代码示例。如果您正苦于以下问题:PHP executeSql函数的具体用法?PHP executeSql怎么用?PHP executeSql使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了executeSql函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: signup
function signup($first_name, $last_name, $age, $email, $password)
{
$sql = sprintf("SELECT user_id FROM user WHERE email = '%s'", $email);
$exists = executeSql($sql);
if (mysql_num_rows($exists) == 1) {
return "exists";
} else {
$sql = sprintf("INSERT INTO user (first_name, last_name, age, email, password, receive_notifications, is_new, lang_id) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $first_name, $last_name, $age, $email, md5($password), "0", "1", "1");
return executeSql($sql);
}
}
示例2: createTable
/**
* [createTable 创建按天分表的表格 若不存在则新建 $table_yyyymmdd]
* @param [type] $tableName [description]
* @param [type] $prefix [description]
* @return [type] [description]
*/
public function createTable($tableName, $prefix)
{
//默认已经创建基表直接复制
$basic = $tableName . "_basic";
$tableName = $tableName . "_" . $prefix;
$sql = "CREATE TABLE if not exists `" . $tableName . "` like {$basic}";
// $this->mysqlConnect();
// $ret = mysql_query($sql);
$ret = executeSql($sql, false);
return $tableName;
}
示例3: setModuleUserProgress
function setModuleUserProgress($user_id, $module_id, $progress, $is_complete, $date_completed)
{
$module_already_added = isModuleAlreadyAdded($user_id, $module_id);
if ($module_already_added) {
return '{"status": "error", "message": "The user has already selected this module"}';
} else {
$sql = sprintf("INSERT INTO user_module (user_id, module_id, progress, is_complete, date_completed) VALUE ('%s', '%s', '%s', '%s', '%s')", $user_id, $module_id, $progress, $is_complete, $date_completed);
$done = executeSql($sql);
if ($done) {
return '{"status": "ok", "message": "Module has been added successfully!", "module_id": ' . $module_id . '}';
} else {
return '{"status": "error", "message": "There was a problem while adding this module. Please try again later"}';
}
}
}
示例4: saveBeaconData
function saveBeaconData($uuid = null)
{
$conf = new Conf();
global $dbConnection;
//db credentials
$dbInfo['host'] = $conf->dbhost;
$dbInfo['username'] = $conf->dbuser;
$dbInfo['password'] = $conf->dbpass;
$dbInfo['database'] = $conf->dbname;
$dbInfo['port'] = $conf->dbport;
$dbConnection = createDbConnection($dbInfo['host'], $dbInfo['username'], $dbInfo['password'], $dbInfo['database'], $dbInfo['port']);
executeSql("UPDATE `hs_hr_config` SET `value` = '{$uuid}' WHERE `key` = 'beacon.uuid'");
executeSql("UPDATE `hs_hr_config` SET `value` = 'on' WHERE `key` = 'beacon.activiation_status'");
mysqli_close($dbConnection);
return true;
}
示例5: saveBeaconData
function saveBeaconData()
{
include_once 'lib/confs/Conf.php';
$conf = new Conf();
global $dbConnection;
//db credentials
$dbInfo['host'] = $conf->dbhost;
$dbInfo['username'] = $conf->dbuser;
$dbInfo['password'] = $conf->dbpass;
$dbInfo['database'] = $conf->dbname;
$dbInfo['port'] = $conf->dbport;
$dbConnection = createDbConnection($dbInfo['host'], $dbInfo['username'], $dbInfo['password'], $dbInfo['database'], $dbInfo['port']);
if ($_POST['hearbeatSelect'] == 'on') {
executeSql("UPDATE `hs_hr_config` SET `value` = 'on' WHERE `key` = 'beacon.activation_acceptance_status'");
}
$companyName = trim(addslashes($_POST['registerCompanyName']));
executeSql("INSERT INTO `ohrm_organization_gen_info`(`name`) VALUES ('" . $companyName . "') ");
mysqli_close($dbConnection);
return true;
}
示例6: main
function main()
{
// Cria BD e tabela
$db = new PDO("sqlite:teste.db");
executeSql($db, "create table cadastro(nome varchar(80) not null primary key, nascimento text not null)");
// Limpa a tabela eliminando registros existentes
executeSql($db, "delete from cadastro");
// Inclui linhas na tabela
executeSql($db, "insert into cadastro values('Maria', '2010-01-21')");
executeSql($db, "insert into cadastro values('José', '1995-10-09')");
executeSql($db, "insert into cadastro values('Ada', '2011-07-15')");
// Tentativa de incluir chave primária duplicada
executeSql($db, "insert into cadastro values('Ada', '2011-11-12')");
// Inclusão de valor de tipo diferente do configurado para a coluna
executeSql($db, "insert into cadastro values('Eliseu', 3.1415)");
// Atualiza dado de uma linha
executeSql($db, "update cadastro set nome='Maria José' where nome='Maria'");
// Mostra conteúdo da tabela
imprimir($db);
}
示例7: MATCH
JOIN faq_response AS fr ON
fr.FAQ_QuestionId = fq.Id
WHERE MATCH(fr.Text) AGAINST(:searchQuery)
ORDER BY fq.Text ASC
', ['searchQuery' => $searchQuery]);
foreach ($answers as $answer) {
if (!isset($resultQuestions[$answer->id])) {
$resultQuestions[$answer->id] = ['id' => $answer->id, 'name' => $answer->text];
}
}
$result = ['questions' => array_values($resultQuestions)];
$app->response->headers->set('Content-Type', 'application/json');
$app->response->write(json_encode($result));
});
$app->get('/questions/:id/answers', function ($id) use($app) {
$answers = executeSql('
SELECT
fr.Id AS id,
fr.Text AS text
FROM faq_response AS fr
WHERE fr.FAQ_QuestionId = :questionId
', ['questionId' => $id]);
$result = [];
foreach ($answers as $answer) {
$result[] = ['id' => $answer->id, 'text' => $answer->text];
}
$app->response->headers->set('Content-Type', 'application/json');
$app->response->write(json_encode($result));
});
include_once 'expert_operations.php';
$app->run();
示例8: executeSql
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Zen Cart™ Installer</title>
<link rel="stylesheet" type="text/css" href="includes/templates/template_default/css/stylesheet.css">
</head>
<div id="wrap">
<div id="header">
<img src="includes/templates/template_default/images/zen_header_bg.jpg">
</div>
<div class="progress" align="center">Installation In Progress...<br /><br />
<?php
}
executeSql($_POST['db_type'] . '_zencart.sql', $_POST['db_name'], $_POST['db_prefix']);
//update the cache folder setting:
$sql = "update " . $_POST['db_prefix'] . "configuration set configuration_value='" . $_POST['sql_cache_dir'] . "' where configuration_key='SESSION_WRITE_DIRECTORY'";
$db->Execute($sql);
//update the phpbb setting:
$sql = "update " . $_POST['db_prefix'] . "configuration set configuration_value='" . $_GET['use_phpbb'] . "' where configuration_key='PHPBB_LINKS_ENABLED'";
$db->Execute($sql);
$db->Close();
// done - now onto next page for Store Setup (entries into database)
if ($zc_show_progress == 'yes') {
$linkto = 'index.php?main_page=store_setup&language=' . $language;
$link = '<a href="' . $linkto . '">' . '<br /><br />Done!<br />Click Here To Continue<br /><br />' . '</a>';
echo "\n<script type=\"text/javascript\">\nwindow.location=\"{$linkto}\";\n</script>\n";
echo '<noscript>' . $link . '</noscript><br /><br />';
echo '<div id="footer"><p>Copyright © 2003, 2004, 2005 <a href="http://www.zen-cart.com" target="_blank">Zen Cart</a></p></div></div></body></html>';
}
示例9: queryFactory
if (!$zc_install->fatal_error && isset($_POST['adminid']) && isset($_POST['adminpwd'])) {
$zc_install->fileExists('sql/' . DB_TYPE . $sniffer_file, DB_TYPE . $sniffer_file . ' ' . ERROR_TEXT_DB_SQL_NOTEXIST, ERROR_CODE_DB_SQL_NOTEXIST);
$zc_install->functionExists(DB_TYPE, ERROR_TEXT_DB_NOTSUPPORTED, ERROR_CODE_DB_NOTSUPPORTED);
$zc_install->dbConnect(DB_TYPE, DB_SERVER, DB_DATABASE, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, ERROR_TEXT_DB_CONNECTION_FAILED, ERROR_CODE_DB_CONNECTION_FAILED, ERROR_TEXT_DB_NOTEXIST, ERROR_CODE_DB_NOTEXIST);
$zc_install->verifyAdminCredentials($_POST['adminid'], $_POST['adminpwd']);
}
//end if !fatal_error
if (ZC_UPG_DEBUG2 == true) {
echo 'Processing [' . $sniffer_file . ']...<br />';
}
if ($zc_install->error == false && $nothing_to_process == false) {
//open database connection to run queries against it
$db = new queryFactory();
$db->Connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE) or die("Unable to connect to database");
// load the upgrade.sql file(s) relative to the required step(s)
$query_results = executeSql('sql/' . DB_TYPE . $sniffer_file, DB_DATABASE, DB_PREFIX);
if ($query_results['queries'] > 0 && $query_results['queries'] != $query_results['ignored']) {
$messageStack->add('upgrade', $query_results['queries'] . '条指令成功执行。', 'success');
} else {
$messageStack->add('upgrade', '失败: ' . $query_results['queries'], 'error');
}
if (zen_not_null($query_results['errors'])) {
foreach ($query_results['errors'] as $value) {
$messageStack->add('upgrade-error-details', '忽略: ' . $value, 'error');
}
}
if ($query_results['ignored'] != 0) {
$messageStack->add('upgrade', '说明: ' . $query_results['ignored'] . '条指令未执行。详情查看 "upgrade_exceptions" 数据表。', 'caution');
}
/* if (zen_not_null($query_results['output'])) {
foreach ($query_results['output'] as $value) {
示例10: file
$messageStack->add('INFO: ' . $value, 'caution');
}
}
}
} else {
$messageStack->add(ERROR_NOTHING_TO_DO, 'error');
}
break;
case 'uploadquery':
$upload_query = file($_FILES['sql_file']['tmp_name']);
$query_string = $upload_query;
if (@get_magic_quotes_runtime() > 0) {
$query_string = zen_db_prepare_input($upload_query);
}
if ($query_string != '') {
$query_results = executeSql($query_string, DB_DATABASE, DB_PREFIX);
if ($query_results['queries'] > 0 && $query_results['queries'] != $query_results['ignored']) {
$messageStack->add($query_results['queries'] . ' statements processed.', 'success');
} else {
$messageStack->add('Failed: ' . $query_results['queries'], 'error');
}
if (zen_not_null($query_results['errors'])) {
foreach ($query_results['errors'] as $value) {
$messageStack->add('ERROR: ' . $value, 'error');
}
}
if ($query_results['ignored'] != 0) {
$messageStack->add('Note: ' . $query_results['ignored'] . ' statements ignored. See "upgrade_exceptions" table for additional details.', 'caution');
}
if (zen_not_null($query_results['output'])) {
foreach ($query_results['output'] as $value) {
示例11: dbDemoDataInstall
function dbDemoDataInstall()
{
$this->dbActivate();
// can likely remove this line for v1.4
global $db;
$db = $this->db;
executeSql('demo/' . DB_TYPE . '_demo.sql', DB_DATABASE, DB_PREFIX);
}
示例12: executeSql
<?php
if (!mysql_num_rows(mysql_query("SHOW TABLES LIKE 'twitter'"))) {
executeSql("plugins/tw/db.sql");
}
$sql = mysql_query("SELECT twiter FROM users");
if (!$sql) {
mysql_query("ALTER TABLE users ADD twitter varchar(255) NOT NULL");
}
register_filter('index_icons', 'twitter_icon');
function twitter_icon($icons)
{
return $icons . '<td align="center" width="14%" valign="top"><img src="60/twitter.png" alt="Get Twitter Followers"><br><b>Twitter Followers</b></td>';
}
register_filter('settings', 'twitter_settings');
function twitter_settings($settings)
{
$user = mysql_query("SELECT twitter FROM `users` WHERE `username`='{$_SESSION['username']}'");
$data = mysql_fetch_object($user);
return $settings . 'Twitter<br/><input name="twitter" type="text" value="' . $data->twitter . '"><br/><br/>';
}
register_filter('settings_sumbit', 'twitter_settings_submit');
function twitter_settings_submit($settings)
{
return $settings . ", `twitter` = '{$_POST['twitter']}'";
}
register_filter('top_menu_earn', 'twitter_top_menu');
function twitter_top_menu($menu)
{
return $menu . "<li><a href='xchange.php?p=tw'>Twitter</a></li>";
}
示例13: getUserById
function getUserById($user_id)
{
$sql = sprintf("SELECT user_id, first_name, last_name, age, email, receive_notifications, is_new, lang_id FROM user WHERE user_id = '%d'", $user_id);
return executeSql($sql);
}
示例14: removeStepProgress
function removeStepProgress($step_id, $user_id)
{
$sql = sprintf("DELETE FROM user_step WHERE user_id = '%d' AND step_id = '%d'", $user_id, $step_id);
return executeSql($sql);
}
示例15: dropDB
/**
* 删除数据库
*
* @param resource $con 数据库连接
* @param string $dbname 数据库名
* @return array array($result, $info, $target)
* $result 创建结果
* $info 出错信息
* $target 出错目标
*/
function dropDB($con, $dbname)
{
$result = true;
$info = '';
$target = 'alert';
$sql = 'DROP DATABASE `' . $dbname . '`';
list($result, $infos) = executeSql($con, $sql);
$info = implode("\n", $infos);
$result = $result ? 0 : 1;
return array($result, $info, $target);
}