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


PHP report_sql_error函数代码示例

本文整理汇总了PHP中report_sql_error函数的典型用法代码示例。如果您正苦于以下问题:PHP report_sql_error函数的具体用法?PHP report_sql_error怎么用?PHP report_sql_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: fun_images_create

function fun_images_create($image)
{
    $query = 'INSERT INTO fun_images (timestamp, handle, title, description, category)';
    $query .= ' VALUES("' . time() . '", "' . $image['handle'] . '", "' . $image['title'] . '", "' . $image['description'] . '", "' . $image['category'] . '")';
    mysql_query($query) or report_sql_error($query);
    echo 'Running query: ' . $query;
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:7,代码来源:fun_images.lib.php

示例2: rss_create_items

function rss_create_items($param)
{
    $query = 'SELECT l.username AS sender_name, gb.message, gb.timestamp AS sent, gb.id
FROM traffa_guestbooks AS gb, login AS l
WHERE gb.recipient = ' . $param['uid'] . ' AND gb.is_private = 0 AND gb.deleted = 0 AND l.id = gb.sender AND gb.sender != 2348
ORDER BY gb.timestamp DESC
LIMIT ' . $param['limit'];
    $res = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    if (mysql_num_rows($res) > 0) {
        while ($data = mysql_fetch_assoc($res)) {
            $data['sent'] = date('r', $data['sent']);
            $out .= "\t" . '<item>' . "\n";
            $out .= "\t\t" . '<title><![CDATA[' . (strlen($data['message']) > 37 ? substr($data['message'], 0, 40) . '...' : $data['message']) . ']]></title>' . "\n";
            //title
            $out .= "\t\t" . '<link>http://www.hamsterpaj.net/traffa/guestbook.php?view=' . $param['uid'] . '#guestbook_entry_' . $data['id'] . '</link>' . "\n";
            //link
            $out .= "\t\t" . '<description><![CDATA[' . (strlen($data['message']) > 150 ? substr($data['message'], 0, 147) . '...' : $data['message']) . ']]></description>' . "\n";
            //description
            $out .= "\t\t" . '<author>' . $data['sender_name'] . '</author>' . "\n";
            //author
            $out .= "\t\t" . '<pubDate>' . $data['sent'] . '</pubDate>' . "\n";
            //date when sent
            $out .= '<guid>http://www.hamsterpaj.net/traffa/guestbook.php?view=' . $param['uid'] . '#guestbook_entry_' . $data['id'] . '</guid>';
            $out .= "\t" . '</item>' . "\n\n";
        }
    }
    return $out;
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:28,代码来源:rss.php

示例3: query_cache

function query_cache($options)
{
    global $QUERY_CACHE_CACHE;
    if (strpos('u.birthday < 1970', $options['query']) === true) {
        die('ERROR!!!');
    }
    $options['category'] = isset($options['category']) ? $options['category'] : 'other';
    $options['max_delay'] = isset($options['max_delay']) ? $options['max_delay'] : 300;
    $path = PATHS_INCLUDE . 'cache/query_cache/' . $options['category'] . '/';
    $filename = md5($options['query']) . '.phpserialized';
    if (isset($QUERY_CACHE_CACHE[$filename])) {
        return $QUERY_CACHE_CACHE[$filename];
    }
    if (!is_dir($path)) {
        mkdir($path);
    }
    if (!file_exists($path . $filename)) {
        trace('new_query_cache_' . $options['category'], $options['query']);
    }
    if (filemtime($path . $filename) < time() - $options['max_delay']) {
        $result = mysql_query($options['query']) or report_sql_error($query, __FILE__, __LINE__);
        while ($row = mysql_fetch_assoc($result)) {
            $data[] = $row;
        }
        $serialized = serialize($data);
        //trace('query_cache', 'Creating file for query: ' . $options['query']);
        file_put_contents($path . $filename, $serialized);
    } else {
        $data = unserialize(file_get_contents($path . $filename));
    }
    $QUERY_CACHE_CACHE[$filename] = $data;
    return $data;
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:33,代码来源:cache.lib.php

示例4: digga_like

function digga_like($artist)
{
    $query = 'INSERT INTO user_artists (user, artist) VALUES("' . $_SESSION['login']['id'] . '", "' . $artist . '")';
    if (mysql_query($query)) {
        $query = 'UPDATE artists SET popularity = popularity + 1 WHERE id = "' . $artist . '"';
        mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    }
    digga_view_info($artist);
}
开发者ID:KuBe-zz,项目名称:hamsterpaj,代码行数:9,代码来源:digga_popup.php

示例5: register_username_exists

function register_username_exists($username)
{
    $query = 'SELECT id FROM login WHERE username LIKE "' . $username . '" LIMIT 1';
    $result = mysql_query($query) or die(report_sql_error($query));
    if (mysql_num_rows($result) == 1) {
        return true;
    }
    return false;
}
开发者ID:Rojk,项目名称:hamsterpaj,代码行数:9,代码来源:register.lib.php

示例6: friends_actions_insert

function friends_actions_insert($options)
{
    $friends_options['friend_id'] = $_SESSION['login']['id'];
    $friends = friends_fetch($friends_options);
    foreach ($friends as $friend) {
        $query = 'INSERT INTO friends_notices (user_id, timestamp, friend_id, action, url, label)';
        $query .= ' VALUES("' . $friend['user_id'] . '", "' . time() . '", "' . $_SESSION['login']['id'] . '", "' . $options['action'] . '", "' . $options['url'] . '", "' . $options['label'] . '")';
        $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    }
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:10,代码来源:friends.lib.php

示例7: post_get_timestamp

function post_get_timestamp($post_id)
{
    $query = 'SELECT timestamp FROM posts WHERE id = "' . $matches[2] . '"';
    $result = mysql_query($query) or die(report_sql_error($query));
    if ($data = mysql_fetch_assoc($result)) {
        $timestamp = $data['timestamp'];
    } else {
        $timestamp = null;
    }
    return $timestamp;
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:11,代码来源:markup.php

示例8: parlino_sms_credits

function parlino_sms_credits($user)
{
    $credits = 3;
    $query = 'SELECT sms_sent FROM parlino_sms_credits WHERE user = "' . $user . '" AND date = "' . date('Y-m-d') . '"';
    $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    if (mysql_num_rows($result) == 1) {
        $data = mysql_fetch_assoc($result);
        $credits -= $data['sms_sent'];
    }
    return $credits;
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:11,代码来源:parlino.php

示例9: digga_fetch_diggers

function digga_fetch_diggers($artist_id)
{
    $query = 'SELECT ua.user AS id, l.username, l.lastaction, u.gender, u.birthday, z.spot ';
    $query .= 'FROM user_artists AS ua, login AS l, userinfo AS u, zip_codes AS z ';
    $query .= 'WHERE ua.artist = "' . $artist_id . '" AND l.id = ua.user AND u.userid = ua.user AND ';
    $query .= 'z.zip_code = u.zip_code ';
    $query .= 'ORDER BY l.lastaction DESC LIMIT 50';
    $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    while ($data = mysql_fetch_assoc($result)) {
        $return[] = $data;
    }
    return $return;
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:13,代码来源:diggers.php

示例10: groups_create

function groups_create($options)
{
    $options['founder'] = !isset($options['founder']) ? $_SESSION['login']['id'] : $options['founder'];
    $options['handle'] = !isset($options['handle']) ? url_secure_string($options['name']) : $options['handle'];
    $query = 'INSERT INTO groups(handle, name, description, member_count, created_timestamp, founder, forum_id, auto_join, visible)' . "\n";
    $query .= 'VALUES("' . $options['handle'] . '", "' . $options['name'] . '", "' . $options['description'] . '", 0, ' . time() . ', "' . $options['founder'] . '", 0, "' . $options['auto_join'] . '", "' . $options['visible'] . '")';
    mysql_query($query) or report_sql_error($query);
    $options['id'] = mysql_insert_id();
    if ($options['disable_founder_join'] != true) {
        groups_add_user_to_group(array('group_id' => $options['id'], 'user_id' => $options['founder']));
    }
    return $options;
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:13,代码来源:groups.lib.php

示例11: friends_actions_insert

function friends_actions_insert($options)
{
    $query = 'SELECT user_id';
    $query .= ' FROM friendslist';
    $query .= ' WHERE';
    $query .= '	friend_id = "' . $_SESSION['login']['id'] . '"';
    $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    while ($data = mysql_fetch_assoc($result)) {
        $query_insert = 'INSERT INTO friends_notices (user_id, timestamp, friend_id, action, url, label)';
        $query_insert .= ' VALUES("' . $data['user_id'] . '", "' . time() . '", "' . $_SESSION['login']['id'] . '", "' . $options['action'] . '", "' . $options['url'] . '", "' . $options['label'] . '")';
        $result_insert = mysql_query($query_insert) or report_sql_error($query_insert, __FILE__, __LINE__);
    }
}
开发者ID:Rambutan,项目名称:hamsterpaj,代码行数:13,代码来源:friends.lib.php

示例12: guestbook_insert

function guestbook_insert($entry)
{
    if ($entry['is_mass_gb'] !== true) {
        if ($_SESSION['login']['id'] == $entry['sender']) {
            if ($_SESSION['last_gb_entry'] > time() - 5) {
                return false;
            }
        }
        if (strlen($entry['message']) == 0) {
            return false;
        }
        if ($entry['recipient'] == 2348 && $entry['sender'] != 2348) {
            $_SESSION['posted_gb_to_webmaster'] = true;
        }
    }
    $entry['is_private'] = $entry['is_private'] == 1 ? 1 : 0;
    $query = 'INSERT INTO traffa_guestbooks(timestamp, recipient, sender, message, is_private)';
    $query .= ' VALUES("' . time() . '", "' . $entry['recipient'] . '", "' . $entry['sender'] . '", "' . $entry['message'] . '", "' . $entry['is_private'] . '")';
    mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    $entry['id'] = mysql_insert_id();
    $query = 'UPDATE userinfo SET gb_entries = gb_entries + 1 WHERE userid = "' . $entry['recipient'] . '" LIMIT 1';
    if (!mysql_query($query)) {
        report_sql_error($query, __FILE__, __LINE__);
        return false;
    }
    if (isset($entry['reply-to'])) {
        $query = 'UPDATE traffa_guestbooks SET answered = "Y", `read` =  1 WHERE id = "' . $entry['reply-to'] . '" AND recipient = "' . $entry['sender'] . '" LIMIT 1';
        if (!mysql_query($query)) {
            report_sql_error($query, __FILE__, __LINE__);
            return false;
        }
    }
    if ($entry['is_mass_gb'] !== true) {
        $query = 'SELECT session_id FROM login WHERE id = "' . $entry['recipient'] . '" LIMIT 1';
        $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
        $data = mysql_fetch_assoc($result);
        if (strlen($data['session_id']) > 5) {
            $remote_session = session_load($data['session_id']);
            $remote_session['notices']['unread_gb_entries'] += 1;
            $entry['image'] = $_SESSION['userinfo']['image'];
            $entry['timestamp'] = time();
            $entry['message'] = stripslashes($entry['message']);
            $entry['username'] = $_SESSION['login']['username'];
            $remote_session['unread_gb_entries'][] = $entry;
            session_save($data['session_id'], $remote_session);
        }
    }
    $_SESSION['last_gb_entry'] = time();
    return true;
}
开发者ID:Rojk,项目名称:hamsterpaj,代码行数:50,代码来源:guestbook.lib.php

示例13: fp_modules_fetch

function fp_modules_fetch($options)
{
    $query = 'SELECT * FROM fp_modules WHERE 1';
    $query .= isset($options['removal_min']) ? ' AND removal >= "' . $options['removal_min'] . '"' : '';
    $query .= isset($options['removal_max']) ? ' AND removal <= "' . $options['removal_max'] . '"' : '';
    $query .= isset($options['launch_min']) ? ' AND launch >= "' . $options['launch_min'] . '"' : '';
    $query .= isset($options['launch_max']) ? ' AND launch <= "' . $options['launch_max'] . '"' : '';
    $query .= isset($options['id']) ? ' AND id = "' . $options['id'] . '"' : '';
    $query .= isset($options['order-by']) ? ' ORDER BY ' . $options['order-by'] : ' ORDER BY priority';
    $query .= isset($options['order-direction']) ? ' ' . $options['order-direction'] : ' DESC';
    $result = mysql_query($query) or report_sql_error($query);
    while ($data = mysql_fetch_assoc($result)) {
        $modules[] = $data;
    }
    return $modules;
}
开发者ID:Rambutan,项目名称:hamsterpaj,代码行数:16,代码来源:fp_modules.lib.php

示例14: tips_reciever_status_set

function tips_reciever_status_set($options)
{
    /*
    options				kommentar
    reciever			e-mail
    hash				hash password
    status				'accepts', 'denies'
    */
    $query = 'UPDATE tips_recievers SET status="' . $options['status'] . '" WHERE';
    if (isset($options['hash'])) {
        $query .= ' hash="' . $options['hash'] . '"';
    } else {
        $query .= ' reciever="' . $options['reciever'] . '"';
    }
    $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    return $result > 0;
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:17,代码来源:tips.lib.php

示例15: suggestion_fetch

function suggestion_fetch($fetch)
{
    $fetch['display_level'] = isset($fetch['display_level']) ? $fetch['display_level'] : array('normal');
    $query = 'SELECT s.*, al.username AS author_username, login.username AS responsible_username FROM login AS al, suggestions AS s';
    $query .= ' LEFT JOIN login ON s.responsible = login.id';
    $query .= ' WHERE al.id = s.author';
    $query .= isset($fetch['display_level']) ? ' AND s.display_level IN("' . implode('", "', $fetch['display_level']) . '")' : '';
    $query .= isset($fetch['id']) ? ' AND s.id IN("' . implode('", "', $fetch['id']) . '")' : '';
    $query .= isset($fetch['category']) ? ' AND s.category IN("' . implode('", "', $fetch['category']) . '")' : '';
    $query .= isset($fetch['classification']) ? ' AND s.classification IN("' . implode('", "', $fetch['classification']) . '")' : '';
    $query .= ' ORDER BY s.last_update DESC, s.id DESC';
    $query .= isset($fetch['limit']) ? ' LIMIT ' . $fetch['limit'] : '';
    $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    while ($data = mysql_fetch_assoc($result)) {
        $return[$data['id']] = $data;
    }
    return $return;
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:18,代码来源:suggestions.lib.php


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