本文整理汇总了PHP中my_mysql_query函数的典型用法代码示例。如果您正苦于以下问题:PHP my_mysql_query函数的具体用法?PHP my_mysql_query怎么用?PHP my_mysql_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了my_mysql_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_music
function create_music($params)
{
$limit = 50;
if (array_key_exists('limit', $params)) {
$limit = $params['limit'];
}
$res = '';
$query = sprintf('SELECT id,title,track,artist,album,comment,year,genre,filename,date FROM TbMsHearing ORDER BY date DESC LIMIT %s', $limit);
$result = my_mysql_query($query);
$res .= multi_accordion_start();
while ($row = $result->fetch_assoc()) {
$header = $row['title'] . ' / ' . $row['album'] . ' / ' . $row['artist'];
$body = '';
$body .= '<ul>';
$body .= '<li>id: ' . $row['id'] . '</li>';
$body .= '<li>title: ' . $row['title'] . '</li>';
$body .= '<li>track: ' . $row['track'] . '</li>';
$body .= '<li>artist: ' . $row['artist'] . '</li>';
$body .= '<li>album: ' . $row['album'] . '</li>';
$body .= '<li>comment: ' . $row['comment'] . '</li>';
$body .= '<li>year: ' . $row['year'] . '</li>';
$body .= '<li>genre: ' . $row['genre'] . '</li>';
$body .= '<li>filename: ' . $row['filename'] . '</li>';
$body .= '<li>date: ' . $row['date'] . '</li>';
$body .= '</ul>';
$res .= multi_accordion_entry($header, $body);
}
my_mysql_free_result($result);
$res .= multi_accordion_end();
return $res;
}
示例2: has_child
function has_child($id)
{
//$query = "select count(*) from collections where parent_id=$id";
$query = select_query("count(*)", "collections", "parent_id={$id}");
$rs = my_mysql_query($query);
$row = my_mysql_fetch_array($rs);
return $row[0] > 0 ? true : false;
}
示例3: create_certification
function create_certification($params)
{
$res = '';
// sending query
$query = sprintf('SELECT id,name,slug,url,imageId,fromDate FROM TbOrganization where funcCertification order by name asc');
$result = my_mysql_query($query);
$res .= get_start_table();
$res .= '<tr>';
$res .= '<td style=\'width:20%\'>type of certification</td>';
$res .= '<td style=\'width:80%\'>date from which I am certified</td>';
$res .= '<td style=\'width:20%\'>image</td>';
$res .= '</tr>';
// printing table rows
while ($row = $result->fetch_assoc()) {
$id = $row['id'];
$name = $row['name'];
$slug = $row['slug'];
$url = $row['url'];
$fromDate = $row['fromDate'];
$imageId = $row['imageId'];
$link_img = link_to_direct('GetBlob.php?table=TbImage&select_field=id&select_id=' . $imageId . '&data_field=smallData&name_field=slug&mime_field=smallMime');
$res .= '</tr>';
$res .= '<td><a href=\'' . $url . '\'>' . $name . '</a></td>';
$res .= '<td>' . $fromDate . '</td>';
$res .= '<td><img src=\'' . $link_img . '\'/></td>';
$res .= '</tr>';
}
$result->free();
$res .= '</table>';
return $res;
}
示例4: utils_init
<?php
require 'utils.php';
utils_init();
$debug = 0;
if ($debug) {
print_r($_POST) . "\n";
}
# parameters for this script...
$p_workId = my_get_post_or_null('workId');
$p_typeId = my_get_post_or_null('typeId');
$p_organizationId = my_get_post_or_null('organizationId');
my_mysql_start_transaction();
$query = sprintf('insert into TbWkWorkContrib (workId,typeId,organizationId) values(%s,%s,%s)', my_mysql_real_escape_string($p_workId), my_mysql_real_escape_string($p_typeId), my_mysql_real_escape_string($p_organizationId));
my_mysql_query($query);
$p_id = my_mysql_insert_id();
my_mysql_commit();
echo 'new record successfully inserted with id [' . $p_id . ']';
示例5: make_table
function make_table($query, $desc)
{
$result = my_mysql_query($query);
$res = '';
$res .= '<a title="' . $query . '">' . $desc . '</a>';
$res .= '<table><tbody>';
$first = true;
while ($row = $result->fetch_assoc()) {
if ($first) {
$res .= '<tr>';
# iterate the result and print the headers...
foreach ($row as $k => $v) {
$res .= '<td>' . $k . '</td>';
}
$first = false;
$res .= '</tr>';
}
$res .= '<tr>';
# iterate the result and print the content
foreach ($row as $k => $v) {
$res .= '<td>' . $v . '</td>';
}
$res .= '</tr>';
}
$res .= '</tbody></table>';
$res .= '<br/>';
my_mysql_free_result($result);
return $res;
}
示例6: send
}
}
if ($twit === null) {
send($sock, "PRIVMSG {$nick} :Name/Password Error!");
} else {
if ($twit->numChans() > 10) {
send($sock, "PRIVMSG {$nick} :You can have a maximum of 10 channels");
} else {
if ($twit->isChan($words[3])) {
send($sock, "PRIVMSG {$nick} :Duplicate channel {$words[3]}");
} else {
// Check user is op on chan
$nSql = mysql_real_escape_string($nick);
$cSql = mysql_real_escape_string(strtolower($words[3]));
$sql = "SELECT COUNT(*) AS `cnt` FROM chan c INNER JOIN ison i ON c.chanid=i.chanid INNER JOIN user u ON u.nickid=i.nickid WHERE (u.nick='{$nSql}' AND c.channel='{$cSql}' AND ((i.mode_la = 'Y' OR i.mode_lo = 'Y' OR i.mode_lq = 'Y') OR (u.mode_lo = 'Y')))";
$result = my_mysql_query($sql);
$line = mysql_fetch_assoc($result);
if ($line['cnt'] > 0) {
$twit->addChan($words[3]);
$twit->save(SAVE_DIR . "/{$twit->name}.save");
send($sock, "JOIN {$words[3]}");
send($sock, "PRIVMSG {$nick} :Channel {$words[3]} added");
} else {
send($sock, "PRIVMSG {$nick} :You are not an op in {$words[3]}");
}
}
}
}
}
break;
case 'delchan':
示例7: my_include
<?php
// url to use this script:
// http://veltzer.net/~mark/php/pages/GetBlob.php?table=TbMsLilypond&id=5&field=pdf&type=application/pdf&name_field=filebasename
require 'setup.php';
my_include('src/utils.php');
$p_slug = $_GET['slug'];
$debug = 0;
my_mysql_connect();
$query = sprintf('SELECT id,name,slug,mime,data FROM TbRsBlob where slug="%s"', $p_slug);
if ($debug == 1) {
echo $query . '<br/>';
}
$result = my_mysql_query($query);
# make sure we really have a result
assert($result);
# we should only get one result...
assert(mysql_num_rows($result) == 1);
$row = $result->fetch_assoc();
$r_id = $row['id'];
$r_name = $row['name'];
$r_slug = $row['slug'];
$r_mime = $row['mime'];
$r_data = $row['data'];
# You can see more HTTP headers that may improve stuff in
# http://en.wikipedia.org/wiki/List_of_HTTP_headers
# ideas are: Content-MD5, Content-Length, Last-Modified
# if you want to debug HTTP headers just use wget -S on the
# command line and compared the headers that you are generating
# with the headers that a regular content generates by using
# the web server...
示例8: create_lilypond
function create_lilypond($params)
{
$res = '';
// sending query
$query = sprintf('SELECT id,uuid,title,subtitle,composer,poet,style,piece,copyright,pages,idyoutube,epdfs FROM TbMsLilypond order by title asc');
$result = my_mysql_query($query);
$res .= multi_accordion_start();
while ($row = $result->fetch_assoc()) {
$id = $row['id'];
$s_uuid = $row['uuid'];
$s_title = val_or_na($row['title']);
$s_subtitle = val_or_na($row['subtitle']);
$s_composer = val_or_na($row['composer']);
$s_poet = val_or_na($row['poet']);
$s_style = val_or_na($row['style']);
$s_piece = val_or_na($row['piece']);
$s_copyright = val_or_na($row['copyright']);
$s_pages = val_or_na($row['pages']);
$s_epdfs = val_or_na($row['epdfs']);
$link_ly = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-ly');
$link_pdf = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-pdf');
$link_ps = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-ps');
$link_midi = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-midi');
$link_wav = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-wav');
$link_mp3 = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-mp3');
$link_ogg = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-ogg');
$s_a_ly = '<a href=' . $link_ly . '>ly</a>';
$s_a_pdf = '<a href=' . $link_pdf . '>pdf</a>';
$s_a_ps = '<a href=' . $link_ps . '>ps</a>';
$s_a_midi = '<a href=' . $link_midi . '>midi</a>';
$s_a_wav = '<a href=' . $link_wav . '>wav</a>';
$s_a_mp3 = '<a href=' . $link_mp3 . '>mp3</a>';
$s_a_ogg = '<a href=' . $link_ogg . '>ogg</a>';
$s_idyoutube = $row['idyoutube'];
$header = $s_title;
if ($row['composer'] != NULL) {
$header .= ' / ' . $s_composer;
}
if ($row['poet'] != NULL && $s_poet != $s_composer) {
$header .= ', ' . $s_poet;
}
$body = '';
$body .= '<ul>';
if ($row['id'] != NULL) {
$body .= '<li>id: ' . $id . '</li>';
}
if ($row['title'] != NULL) {
$body .= '<li>title: ' . $s_title . '</li>';
}
if ($row['subtitle'] != NULL) {
$body .= '<li>subtitle: ' . $s_subtitle . '</li>';
}
if ($row['composer'] != NULL) {
$body .= '<li>composer: ' . $s_composer . '</li>';
}
if ($row['poet'] != NULL) {
$body .= '<li>poet: ' . $s_poet . '</li>';
}
if ($row['style'] != NULL) {
$body .= '<li>style: ' . $s_style . '</li>';
}
if ($row['piece'] != NULL) {
$body .= '<li>piece: ' . $s_piece . '</li>';
}
if ($row['copyright'] != NULL) {
$body .= '<li>copyright: ' . $s_copyright . '</li>';
}
if ($row['pages'] != NULL) {
$body .= '<li>pages: ' . $s_pages . '</li>';
}
if ($row['epdfs'] != NULL) {
$body .= '<li>epdfs: ' . $s_epdfs . '</li>';
}
$links = array();
# TODO: only add the links if I have the blobs...
array_push($links, $s_a_ly);
array_push($links, $s_a_pdf);
array_push($links, $s_a_ps);
array_push($links, $s_a_midi);
array_push($links, $s_a_wav);
array_push($links, $s_a_mp3);
array_push($links, $s_a_ogg);
# lets look and add links to the pngs...
for ($i = 0; $i < $s_pages; $i++) {
$j = $i + 1;
$link = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-png' . $j);
$link = '<a href=\'' . $link . '\'>png' . $j . '</a>';
array_push($links, $link);
}
for ($i = 0; $i < $s_epdfs; $i++) {
$link = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-epdf' . $i);
$link = '<a href=\'' . $link . '\'>epdf' . $i . '</a>';
array_push($links, $link);
}
$body .= '<li>links: ' . join(', ', $links) . '</li>';
$body .= '<li>uuid: ' . $s_uuid . '</li>';
$body .= '</ul>';
# lets put a link to play the audio, currently it looks like the
# audio plugin can only play mp3 so that's the only link that we
# put...
//.........这里部分代码省略.........
示例9: create_mvlog
function create_mvlog($v_schema_name, $v_table_name)
{
$v_done = FALSE;
$v_column_name = NULL;
$v_data_type = NULL;
$v_sql = NULL;
$cursor_sql = "SELECT COLUMN_NAME, IF(COLUMN_TYPE='TIMESTAMP', 'TIMESTAMP', COLUMN_TYPE) COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='{$v_table_name}' AND TABLE_SCHEMA = '{$v_schema_name}'";
$cur_columns = my_mysql_query($cursor_sql, $this->source);
$v_sql = '';
while (1) {
if ($v_sql != '') {
$v_sql = FlexCDC::concat($v_sql, ', ');
}
$row = mysql_fetch_array($cur_columns);
if ($row === false) {
$v_done = true;
}
if ($row) {
$v_column_name = '`' . $row[0] . '`';
$v_data_type = $row[1];
}
if ($v_done) {
mysql_free_result($cur_columns);
break;
}
$v_sql = FlexCDC::concat($v_sql, $v_column_name, ' ', $v_data_type);
}
if (trim($v_sql) == "") {
trigger_error('Could not access table:' . $v_table_name, E_USER_ERROR);
}
$v_sql = FlexCDC::concat('CREATE TABLE IF NOT EXISTS`', $this->mvlogDB, '`.`', $v_schema_name, '_', $v_table_name, '` ( dml_type INT DEFAULT 0, uow_id BIGINT, `fv$server_id` INT UNSIGNED,fv$gsn bigint, ', $v_sql, 'KEY(uow_id, dml_type) ) ENGINE=INNODB');
$create_stmt = my_mysql_query($v_sql, $this->dest);
if (!$create_stmt) {
die1('COULD NOT CREATE MVLOG. ' . $v_sql . "\n");
}
$exec_sql = " INSERT IGNORE INTO `" . $this->mvlogDB . "`.`" . $this->mvlogs . "`( table_schema , table_name , mvlog_name ) values('{$v_schema_name}', '{$v_table_name}', '" . $v_schema_name . "_" . $v_table_name . "')";
my_mysql_query($exec_sql) or die1($exec_sql . ':' . mysql_error($this->dest) . "\n");
return true;
}
示例10: process_rows
protected function process_rows()
{
#echo "IN PROCESS ROWS\n";
#print_r($this);
foreach ($this->table_map as $table_id => $info) {
#FIXME: smartly (and transactionally) invalidate the cache
if ($info->db === $this->mvlogDB && $info->table === $this->mvlogs) {
$this->refresh_mvlog_cache();
}
if (empty($this->mvlogList[$info->db . $info->table])) {
continue;
}
if (!$this->sent_fde) {
$sql = "BINLOG '\n" . chunk_split(base64_encode($this->encode_fde()), 76, "\n") . "'/*!*/;\n";
my_mysql_query($sql, $this->dest) or die1("Could not execute statement:\n" . $sql);
unset($sql);
}
$events = $this->encode_remap_table($table_id);
$events = chunk_split(base64_encode($events), 76, "\n");
if (!empty($this->rows[$table_id]) && $this->rows[$table_id]['old']['images'] != "") {
$events .= chunk_split(base64_encode($this->encode_row_events($table_id, 'old')), 76, "\n");
}
if (!empty($this->rows[$table_id]) && $this->rows[$table_id]['new']['images'] != "") {
$events .= chunk_split(base64_encode($this->encode_row_events($table_id, 'new')), 76, "\n");
}
$sql = "BINLOG '\n{$events}'/*!*/;\n";
unset($events);
my_mysql_query($sql, $this->dest) or die1("Could not execute statement:\n" . $sql);
unset($sql);
}
}
示例11: get_moyenne_dla
function get_moyenne_dla()
{
$sql = "SELECT sum( -DLAH*60-DLAM ) as dla";
$sql .= " FROM " . _TABLEVTT_;
$sql .= " WHERE PVs IS NOT NULL";
$query_result = my_mysql_query($sql);
$row = mysql_fetch_array($query_result);
return intval($row["dla"] / $this->nb_troll);
}
示例12: while
while ($f = readdir($fp)) {
if ($f == '.' || $f == '..') {
continue;
}
$f = $tpldir . '/css/' . $f;
$c = @file_get_contents($f);
if (!$c) {
continue;
}
$c = str_replace('../design/', '../imgs/', $c);
@chmod($f, 0777);
$r = @file_put_contents($f, $c);
@chmod($f, 0755);
}
closedir($fp);
my_mysql_query("REPLACE INTO `settings` SET `word`='THEME', `value`='default' ", $conn);
if (!file_exists('../../themes/include_in_footer.php')) {
$tmp = "<" . "?php\n\n\t\n\t";
$tmp .= "/" . "**\n\t\t\n\t\t";
$tmp .= "This file in included to the Footer of all themes, right before the </body> tag\n\t\t\n\t\t";
$tmp .= "Here you can place web counters.\n\t\t\n\t";
$tmp .= "*/\n\t\n";
$tmp .= "?" . ">\n";
@file_put_contents('../../themes/include_in_footer.php', $tmp);
}
}
if (!$error) {
directory_tree_delete(INCPATH . '../../system/templates/');
directory_tree_delete(INCPATH . '../../i/design/');
directory_tree_delete(INCPATH . '../../i/css/');
directory_tree_delete(INCPATH . '../../i/js/');
示例13: statement
function statement($sql)
{
$sql = trim($sql);
if (substr($sql, 0, 6) == '/*!\\C ') {
return;
}
/*
if($sql[0] == '/') {
$end_comment = strpos($sql, ' ');
$sql = trim(substr($sql, $end_comment, strlen($sql) - $end_comment));
}
*/
preg_match("/([^ ]+)(.*)/", $sql, $matches);
//print_r($matches);
$command = $matches[1];
$command = str_replace($this->delimiter, '', $command);
$args = $matches[2];
switch (strtoupper($command)) {
#register change in delimiter so that we properly capture statements
case 'DELIMITER':
$this->delimiter = trim($args);
break;
#NEW TRANSACTION
#NEW TRANSACTION
case 'BEGIN':
$this->start_transaction();
break;
#END OF BINLOG, or binlog terminated early, or mysqlbinlog had an error
#END OF BINLOG, or binlog terminated early, or mysqlbinlog had an error
case 'ROLLBACK':
$this->rollback_transaction();
break;
case 'COMMIT':
$this->commit_transaction();
break;
case 'USE':
#fall through and execute the use
$this->activeDB = trim($args);
$this->activeDB = str_replace($this->delimiter, '', $this->activeDB);
default:
my_mysql_query($sql, $this->dest) or die('Could not execute [SBR] statement:' . $sql . ':' . mysql_error($this->dest) . "\n");
break;
}
}
示例14: my_mysql_query
<?php
include_once 'config.php';
include_once 'variables.php';
include_once 'inc_define_vars.php';
?>
<?php
$blason = $_REQUEST["blason"];
if ($blason == "init") {
# il faut tirer au sort le troll à afficher
# tirage au sort d'une ligne de la table
$query_result = my_mysql_query("SELECT nom_image_troll FROM trolls WHERE guilde_troll=" . ID_GUILDE . " ORDER BY rand() LIMIT 1");
$row = mysql_fetch_array($query_result);
$pseudo = $row["nom_image_troll"];
} else {
$pseudo = $blason;
}
# récupération des infos
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Blason</TITLE>
</HEAD>
<BODY bgcolor="#000000" TEXT="yellow" link="cyan" vlink="cyan">
<center>
示例15: parseline
function parseline($bm_row, $ID)
{
debug("raw: {$bm_row}");
// debugging love.
if (get_magic_quotes_gpc() == 1) {
// auto-escape is on...
$bm_row = stripslashes($bm_row);
}
// so remove extra slashes.
debug("final: {$bm_row}");
// debugging love.
$bm_row = trim($bm_row);
// get rid of ooky whitespace.
$cmd = substr($bm_row, 0, 1);
// first char is what command to perform.
$bm_row = substr($bm_row, 3);
// strip token of COMMAND,COMMA,SLASH.
$l = strpos($bm_row, "\"");
// find the end of our bookmark path.
$tpath = substr($bm_row, 0, $l);
// and save the path itself into $tpath.
$path = addslashes($tpath);
// encode slashes and apostraphes for SQL.
// add bookmark
if ($cmd == "A") {
$url = substr($bm_row, strlen($tpath) + 3);
// get the URL from our row.
$url = addslashes(trim($url, "\"\r\n"));
// remove ookiness and junk.
$surl = addslashes(substr($url, 7, 55) . substr($url, -200));
// MySQL indexes can only be 255.
// insert the bookmark.
my_mysql_query("insert into syncit_bookmarks (url, surl) values ('{$url}', '{$surl}')");
$res = my_mysql_query("select bookid from syncit_bookmarks where surl='{$surl}'");
// and check the expiration date. deleted URLs should
// be regularly purged from the database after a certain
// amount of time, but if the current URL is set to be
// deleted, but hasn't yet, we resurrect it.
if ($data = mysql_fetch_assoc($res)) {
$bid = $data['bookid'];
// shorter.
$res = my_mysql_query("insert into syncit_link (expiration, person_id, access, path, " . "book_id) values (NULL, '{$ID}', now(), '{$path}', '{$bid}')");
// bookmark exists already, but expired. Unexpire!
if (!$res) {
my_mysql_query("update syncit_link set expiration = NULL, book_id = '{$bid}' " . "where person_id = '{$ID}' and path = '{$path}'");
}
}
} else {
if ($cmd == "D") {
my_mysql_query("update syncit_link set expiration = now() where path = '{$path}' and person_id = '{$ID}'");
} else {
if ($cmd == "M") {
$res = my_mysql_query("insert into syncit_link (expiration, person_id, access, " . "path) values (NULL, '{$ID}', now(), '{$path}')");
if (!$res) {
// resurrect a deleted directory.
my_mysql_query("update syncit_link set expiration = NULL, book_id = NULL " . "where person_id = '{$ID}' and path = '{$path}'");
}
} else {
if ($cmd == "R") {
my_mysql_query("update syncit_link set expiration = now() where path = '{$path}' and person_id = '{$ID}'");
} else {
my_echo("*E");
my_echo("Invalid Bookmark Command: {$cmd} ");
debug("Invalid Bookmark Command: [{$cmd}].");
return true;
}
}
}
}
return false;
}