sqlserver 全文索引 contains的使用

数据内容是: ,1,23,454,5465, 这样的。
where CONTAINS(字段,',1,') 这样查询会报错
在全文搜索条件 '',1',' 内的 ',' 附近存在语法错误

请问 如果要查询包含 ,1, 的数据,该怎么使用contains呢

想实现和 like '%,1,%' 一样的效果

1个回答

逗号是不是也需要转义啊?

u011249920
简一_hz sql server有两个转义符: 一个转义符就是' 另一个转义符是";你要么试试看行不行
4 年多之前 回复
kpeng163
kpeng163 不知道怎么转义。。
4 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
关于Sql server 全文索引 containstable使用碰到的问题

select * from containstable(t_ck,f_keywords,'教育') 咨询大家一个问题。这条命令我在查询分析器上执行查询结果得到上万的数据,也无任何问题。 但是在PHP上或ASP上执行时就会出现问题。 如:多步 OLE DB 操作产生错误。如果可能,请检查每个 OLE DB 状态值。没有工作被完成。 还有的是循环到第五个记录就提示BOF还是EOF等于真 就没记录了。 ASP和PHP的查询碰到问题都是一模一样的。

sql server 2008建立全文索引后,如何能对全文目录下所有索引进行搜索

本人现只会对其中的一张表进行contains条件查询,我想同时查询多张表,sql语句该如何写呢?

php - 将从SQL Server检索到的时间戳转换为CET

<div class="post-text" itemprop="text"> <p>I'm retrieving several fields from an SQL table one of them being (timestamp in UTC format).<br> I need to either add 2 Hours to the timestamp in or convert the timestamp CET timezone.</p> <p>For the purpose of this question, the variable $EventTime contains the timestamp retreived from the SQL database in this <strong>2015-06-16 15:34:27.000</strong>.</p> <p>I have tried the code below, however I'm sure it's not correct.</p> <pre><code> while($result_row=odbc_fetch_array($sql_run)){ $EventTime=$result_row['EventTime']; $EventTime2=$EventTime; $EventTime2-&gt;setTimezone(new DateTimeZone("Europe/Rome")); echo $EventTime2-&gt;format("F d, Y g:i a") .... } </code></pre> </div>

检索每个组中的最后一条记录 -MySQL

<div class="post-text" itemprop="text"> <p>There is a table <code>messages</code> that contains data as shown below:</p> <pre><code>Id Name Other_Columns ------------------------- 1 A A_data_1 2 A A_data_2 3 A A_data_3 4 B B_data_1 5 B B_data_2 6 C C_data_1 </code></pre> <p>If I run a query <code>select * from messages group by name</code>, I will get the result as:</p> <pre><code>1 A A_data_1 4 B B_data_1 6 C C_data_1 </code></pre> <p>What query will return the following result?</p> <pre><code>3 A A_data_3 5 B B_data_2 6 C C_data_1 </code></pre> <p>That is, the last record in each group should be returned.</p> <p>At present, this is the query that I use:</p> <pre><code>SELECT * FROM (SELECT * FROM messages ORDER BY id DESC) AS x GROUP BY name </code></pre> <p>But this looks highly inefficient. Any other ways to achieve the same result?</p> </div> <p>转载于:https://stackoverflow.com/questions/1313120/retrieving-the-last-record-in-each-group-mysql</p>

在节点内容文本上查找父节点

<div class="post-text" itemprop="text"> <p>Hey, i'm trying to find out the parent-node of the nodes content text.</p> <p>example:</p> <pre><code>&lt;div&gt; &lt;h1&gt;Node to find&lt;/h1&gt; &lt;p&gt;another node&lt;/p&gt; &lt;/div&gt; </code></pre> <p>All my code know is what the text in the node is and my script needs to find out in what node the text contains.</p> <p>i have tried the following xpaths:</p> <pre><code> 1. //*[. = "'. $text .'"] 2. //*[contains(., "'. $text .'")] </code></pre> <p>the first gives me a empty nodeList the second gives me a lot of nodes, but it gives me all the parent containing the text, i want only the first parent.</p> <p>Thanks for any help.</p> </div>

corseek 中文检索时搜不出结果 搜英文单词正常

[root@abc testpack]# /usr/local/coreseek/bin/indexer -c etc/sphinx.conf --all Coreseek Fulltext 4.1 [ Sphinx 2.0.2-dev (r2922)] Copyright (c) 2007-2011, Beijing Choice Software Technologies Inc (http://www.coreseek.com) using config file 'etc/sphinx.conf'... indexing index 'test1'... WARNING: Attribute count is 0: switching to none docinfo collected 5 docs, 0.0 MB sorted 0.0 Mhits, 100.0% done total 5 docs, 186 bytes total 0.064 sec, 2870 bytes/sec, 77.16 docs/sec total 2 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg total 6 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg 检索中文 不出结果 [root@abc testpack]# /usr/local/coreseek/bin/search -c etc/sphinx.conf '水火不容' Coreseek Fulltext 4.1 [ Sphinx 2.0.2-dev (r2922)] Copyright (c) 2007-2011, Beijing Choice Software Technologies Inc (http://www.coreseek.com) using config file 'etc/sphinx.conf'... index 'test1': query '水火不容 ': returned 0 matches of 0 total in 0.000 sec words: 1. '水火': 0 documents, 0 hits 2. '不容': 0 documents, 0 hits 检索英文就能出结果 [root@abc testpack]# /usr/local/coreseek/bin/search -c etc/sphinx.conf 'apple' Coreseek Fulltext 4.1 [ Sphinx 2.0.2-dev (r2922)] Copyright (c) 2007-2011, Beijing Choice Software Technologies Inc (http://www.coreseek.com) using config file 'etc/sphinx.conf'... index 'test1': query 'apple ': returned 1 matches of 1 total in 0.001 sec displaying matches: 1. document=5, weight=2780 id=5 title=apple content=apple,banana words: 1. 'apple': 1 documents, 2 hits 这个是数据库 mysql> select * from tt; +----+--------------+-----------------+ | id | title | content | +----+--------------+-----------------+ | 1 | 西水 | 水水 | | 2 | 水火不容 | 水火不容 | | 3 | 水啊啊 | 啊水货 | | 4 | 东南西水 | 啊西西哈哈 | | 5 | apple | apple,banana | +----+--------------+-----------------+ 5 rows in set (0.00 sec) 下面是配置那个文件 # # Sphinx configuration file sample # # WARNING! While this sample file mentions all available options, # it contains (very) short helper descriptions only. Please refer to # doc/sphinx.html for details. # ############################################################################# ## data source definition ############################################################################# source src1 { # data source type. mandatory, no default value # known types are mysql, pgsql, mssql, xmlpipe, xmlpipe2, odbc type = mysql ##################################################################### ## SQL settings (for 'mysql' and 'pgsql' types) ##################################################################### # some straightforward parameters for SQL source types sql_host = localhost sql_user = root sql_pass = 123456 sql_db = haha sql_port = 3306 # optional, default is 3306 # UNIX socket name # optional, default is empty (reuse client library defaults) # usually '/var/lib/mysql/mysql.sock' on Linux # usually '/tmp/mysql.sock' on FreeBSD # sql_sock = /var/lib/mysql/mysql.sock # MySQL specific client connection flags # optional, default is 0 # # mysql_connect_flags = 32 # enable compression # MySQL specific SSL certificate settings # optional, defaults are empty # # mysql_ssl_cert = /etc/ssl/client-cert.pem # mysql_ssl_key = /etc/ssl/client-key.pem # mysql_ssl_ca = /etc/ssl/cacert.pem # MS SQL specific Windows authentication mode flag # MUST be in sync with charset_type index-level setting # optional, default is 0 # # mssql_winauth = 1 # use currently logged on user credentials # MS SQL specific Unicode indexing flag # optional, default is 0 (request SBCS data) # # mssql_unicode = 1 # request Unicode data from server # ODBC specific DSN (data source name) # mandatory for odbc source type, no default value # # odbc_dsn = DBQ=C:\data;DefaultDir=C:\data;Driver={Microsoft Text Driver (*.txt; *.csv)}; # sql_query = SELECT id, data FROM documents.csv # ODBC and MS SQL specific, per-column buffer sizes # optional, default is auto-detect # # sql_column_buffers = content=12M, comments=1M # pre-query, executed before the main fetch query # multi-value, optional, default is empty list of queries # sql_query_pre = SET NAMES utf8 sql_query_pre = SET SESSION query_cache_type=OFF # main document fetch query # mandatory, integer document ID field MUST be the first selected column sql_query = \ SELECT id, title, content FROM tt # joined/payload field fetch query # joined fields let you avoid (slow) JOIN and GROUP_CONCAT # payload fields let you attach custom per-keyword values (eg. for ranking) # # syntax is FIELD-NAME 'from' ( 'query' | 'payload-query' ); QUERY # joined field QUERY should return 2 columns (docid, text) # payload field QUERY should return 3 columns (docid, keyword, weight) # # REQUIRES that query results are in ascending document ID order! # multi-value, optional, default is empty list of queries # # sql_joined_field = tags from query; SELECT docid, CONCAT('tag',tagid) FROM tags ORDER BY docid ASC # sql_joined_field = wtags from payload-query; SELECT docid, tag, tagweight FROM tags ORDER BY docid ASC # file based field declaration # # content of this field is treated as a file name # and the file gets loaded and indexed in place of a field # # max file size is limited by max_file_field_buffer indexer setting # file IO errors are non-fatal and get reported as warnings # # sql_file_field = content_file_path # sql_query_info = SELECT * FROM tt WHERE id=$id # range query setup, query that must return min and max ID values # optional, default is empty # # sql_query will need to reference $start and $end boundaries # if using ranged query: # # sql_query = \ # SELECT doc.id, doc.id AS group, doc.title, doc.data \ # FROM documents doc \ # WHERE id>=$start AND id<=$end # # sql_query_range = SELECT MIN(id),MAX(id) FROM documents # range query step # optional, default is 1024 # # sql_range_step = 1000 # unsigned integer attribute declaration # multi-value (an arbitrary number of attributes is allowed), optional # optional bit size can be specified, default is 32 # # sql_attr_uint = author_id # sql_attr_uint = forum_id:9 # 9 bits for forum_id #sql_attr_uint = group_id # boolean attribute declaration # multi-value (an arbitrary number of attributes is allowed), optional # equivalent to sql_attr_uint with 1-bit size # # sql_attr_bool = is_deleted # bigint attribute declaration # multi-value (an arbitrary number of attributes is allowed), optional # declares a signed (unlike uint!) 64-bit attribute # # sql_attr_bigint = my_bigint_id # UNIX timestamp attribute declaration # multi-value (an arbitrary number of attributes is allowed), optional # similar to integer, but can also be used in date functions # # sql_attr_timestamp = posted_ts # sql_attr_timestamp = last_edited_ts #sql_attr_timestamp = date_added # string ordinal attribute declaration # multi-value (an arbitrary number of attributes is allowed), optional # sorts strings (bytewise), and stores their indexes in the sorted list # sorting by this attr is equivalent to sorting by the original strings # # sql_attr_str2ordinal = author_name # floating point attribute declaration # multi-value (an arbitrary number of attributes is allowed), optional # values are stored in single precision, 32-bit IEEE 754 format # # sql_attr_float = lat_radians # sql_attr_float = long_radians # multi-valued attribute (MVA) attribute declaration # multi-value (an arbitrary number of attributes is allowed), optional # MVA values are variable length lists of unsigned 32-bit integers # # syntax is ATTR-TYPE ATTR-NAME 'from' SOURCE-TYPE [;QUERY] [;RANGE-QUERY] # ATTR-TYPE is 'uint' or 'timestamp' # SOURCE-TYPE is 'field', 'query', or 'ranged-query' # QUERY is SQL query used to fetch all ( docid, attrvalue ) pairs # RANGE-QUERY is SQL query used to fetch min and max ID values, similar to 'sql_query_range' # # sql_attr_multi = uint tag from query; SELECT docid, tagid FROM tags # sql_attr_multi = uint tag from ranged-query; \ # SELECT docid, tagid FROM tags WHERE id>=$start AND id<=$end; \ # SELECT MIN(docid), MAX(docid) FROM tags # string attribute declaration # multi-value (an arbitrary number of these is allowed), optional # lets you store and retrieve strings # # sql_attr_string = stitle # wordcount attribute declaration # multi-value (an arbitrary number of these is allowed), optional # lets you count the words at indexing time # # sql_attr_str2wordcount = stitle # combined field plus attribute declaration (from a single column) # stores column as an attribute, but also indexes it as a full-text field # # sql_field_string = author # sql_field_str2wordcount = title # post-query, executed on sql_query completion # optional, default is empty # # sql_query_post = # post-index-query, executed on successful indexing completion # optional, default is empty # $maxid expands to max document ID actually fetched from DB # # sql_query_post_index = REPLACE INTO counters ( id, val ) \ # VALUES ( 'max_indexed_id', $maxid ) # ranged query throttling, in milliseconds # optional, default is 0 which means no delay # enforces given delay before each query step sql_ranged_throttle = 0 # document info query, ONLY for CLI search (ie. testing and debugging) # optional, default is empty # must contain $id macro and must fetch the document by that id sql_query_info = SELECT * FROM tt WHERE id=$id # kill-list query, fetches the document IDs for kill-list # k-list will suppress matches from preceding indexes in the same query # optional, default is empty # # sql_query_killlist = SELECT id FROM documents WHERE edited>=@last_reindex # columns to unpack on indexer side when indexing # multi-value, optional, default is empty list # # unpack_zlib = zlib_column # unpack_mysqlcompress = compressed_column # unpack_mysqlcompress = compressed_column_2 # maximum unpacked length allowed in MySQL COMPRESS() unpacker # optional, default is 16M # # unpack_mysqlcompress_maxsize = 16M ##################################################################### ## xmlpipe2 settings ##################################################################### # type = xmlpipe # shell command to invoke xmlpipe stream producer # mandatory # # xmlpipe_command = cat /usr/local/coreseek/var/test.xml # xmlpipe2 field declaration # multi-value, optional, default is empty # # xmlpipe_field = subject # xmlpipe_field = content # xmlpipe2 attribute declaration # multi-value, optional, default is empty # all xmlpipe_attr_XXX options are fully similar to sql_attr_XXX # # xmlpipe_attr_timestamp = published # xmlpipe_attr_uint = author_id # perform UTF-8 validation, and filter out incorrect codes # avoids XML parser choking on non-UTF-8 documents # optional, default is 0 # # xmlpipe_fixup_utf8 = 1 } # inherited source example # # all the parameters are copied from the parent source, # and may then be overridden in this source definition source src1throttled : src1 { sql_ranged_throttle = 100 } ############################################################################# ## index definition ############################################################################# # local index example # # this is an index which is stored locally in the filesystem # # all indexing-time options (such as morphology and charsets) # are configured per local index index test1 { # index type # optional, default is 'plain' # known values are 'plain', 'distributed', and 'rt' (see samples below) # type = plain # document source(s) to index # multi-value, mandatory # document IDs must be globally unique across all sources source = src1 # index files path and file name, without extension # mandatory, path must be writable, extensions will be auto-appended #path = /usr/local/coreseek/var/data/test1 # document attribute values (docinfo) storage mode # optional, default is 'extern' # known values are 'none', 'extern' and 'inline' docinfo = extern # memory locking for cached data (.spa and .spi), to prevent swapping # optional, default is 0 (do not mlock) # requires searchd to be run from root mlock = 0 # a list of morphology preprocessors to apply # optional, default is empty # # builtin preprocessors are 'none', 'stem_en', 'stem_ru', 'stem_enru', # 'soundex', and 'metaphone'; additional preprocessors available from # libstemmer are 'libstemmer_XXX', where XXX is algorithm code # (see libstemmer_c/libstemmer/modules.txt) # # morphology = stem_en, stem_ru, soundex # morphology = libstemmer_german # morphology = libstemmer_sv morphology = none # minimum word length at which to enable stemming # optional, default is 1 (stem everything) # # min_stemming_len = 1 path = /root/rearch_dir # stopword files list (space separated) # optional, default is empty # contents are plain text, charset_table and stemming are both applied # # stopwords = /usr/local/coreseek/var/data/stopwords.txt # wordforms file, in "mapfrom > mapto" plain text format # optional, default is empty # # wordforms = /usr/local/coreseek/var/data/wordforms.txt # tokenizing exceptions file # optional, default is empty # # plain text, case sensitive, space insensitive in map-from part # one "Map Several Words => ToASingleOne" entry per line # # exceptions = /usr/local/coreseek/var/data/exceptions.txt # minimum indexed word length # default is 1 (index everything) min_word_len = 1 # charset encoding type # optional, default is 'sbcs' # known types are 'sbcs' (Single Byte CharSet) and 'utf-8' charset_type = zh_cn.utf-8 charset_dictpath = /usr/local/mmseg3/etc/ # charset definition and case folding rules "table" # optional, default value depends on charset_type # # defaults are configured to include English and Russian characters only # you need to change the table to include additional ones # this behavior MAY change in future versions # # 'sbcs' default value is # charset_table = 0..9, A..Z->a..z, _, a..z, U+A8->U+B8, U+B8, U+C0..U+DF->U+E0..U+FF, U+E0..U+FF # # 'utf-8' default value is #charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F # ignored characters list # optional, default value is empty # # ignore_chars = U+00AD # minimum word prefix length to index # optional, default is 0 (do not index prefixes) # # min_prefix_len = 0 # minimum word infix length to index # optional, default is 0 (do not index infixes) # # min_infix_len = 0 # list of fields to limit prefix/infix indexing to # optional, default value is empty (index all fields in prefix/infix mode) # # prefix_fields = filename # infix_fields = url, domain # enable star-syntax (wildcards) when searching prefix/infix indexes # search-time only, does not affect indexing, can be 0 or 1 # optional, default is 0 (do not use wildcard syntax) # # enable_star = 1 # expand keywords with exact forms and/or stars when searching fit indexes # search-time only, does not affect indexing, can be 0 or 1 # optional, default is 0 (do not expand keywords) # # expand_keywords = 1 # n-gram length to index, for CJK indexing # only supports 0 and 1 for now, other lengths to be implemented # optional, default is 0 (disable n-grams) # ngram_len = 0 # n-gram characters list, for CJK indexing # optional, default is empty # # ngram_chars = U+3000..U+2FA1F # phrase boundary characters list # optional, default is empty # # phrase_boundary = ., ?, !, U+2026 # horizontal ellipsis # phrase boundary word position increment # optional, default is 0 # # phrase_boundary_step = 100 # blended characters list # blended chars are indexed both as separators and valid characters # for instance, AT&T will results in 3 tokens ("at", "t", and "at&t") # optional, default is empty # # blend_chars = +, &, U+23 # blended token indexing mode # a comma separated list of blended token indexing variants # known variants are trim_none, trim_head, trim_tail, trim_both, skip_pure # optional, default is trim_none # # blend_mode = trim_tail, skip_pure # whether to strip HTML tags from incoming documents # known values are 0 (do not strip) and 1 (do strip) # optional, default is 0 html_strip = 0 # what HTML attributes to index if stripping HTML # optional, default is empty (do not index anything) # # html_index_attrs = img=alt,title; a=title; # what HTML elements contents to strip # optional, default is empty (do not strip element contents) # # html_remove_elements = style, script # whether to preopen index data files on startup # optional, default is 0 (do not preopen), searchd-only # # preopen = 1 # whether to keep dictionary (.spi) on disk, or cache it in RAM # optional, default is 0 (cache in RAM), searchd-only # # ondisk_dict = 1 # whether to enable in-place inversion (2x less disk, 90-95% speed) # optional, default is 0 (use separate temporary files), indexer-only # # inplace_enable = 1 # in-place fine-tuning options # optional, defaults are listed below # # inplace_hit_gap = 0 # preallocated hitlist gap size # inplace_docinfo_gap = 0 # preallocated docinfo gap size # inplace_reloc_factor = 0.1 # relocation buffer size within arena # inplace_write_factor = 0.1 # write buffer size within arena # whether to index original keywords along with stemmed versions # enables "=exactform" operator to work # optional, default is 0 # # index_exact_words = 1 # position increment on overshort (less that min_word_len) words # optional, allowed values are 0 and 1, default is 1 # # overshort_step = 1 # position increment on stopword # optional, allowed values are 0 and 1, default is 1 # # stopword_step = 1 # hitless words list # positions for these keywords will not be stored in the index # optional, allowed values are 'all', or a list file name # # hitless_words = all # hitless_words = hitless.txt # detect and index sentence and paragraph boundaries # required for the SENTENCE and PARAGRAPH operators to work # optional, allowed values are 0 and 1, default is 0 # # index_sp = 1 # index zones, delimited by HTML/XML tags # a comma separated list of tags and wildcards # required for the ZONE operator to work # optional, default is empty string (do not index zones) # # index_zones = title, h*, th } # inherited index example # # all the parameters are copied from the parent index, # and may then be overridden in this index definition #index test1stemmed : test1 #{ # path = /usr/local/coreseek/var/data/test1stemmed # morphology = stem_en #} # distributed index example # # this is a virtual index which can NOT be directly indexed, # and only contains references to other local and/or remote indexes #index dist1 #{ # 'distributed' index type MUST be specified # type = distributed # local index to be searched # there can be many local indexes configured # local = test1 # local = test1stemmed # remote agent # multiple remote agents may be specified # syntax for TCP connections is 'hostname:port:index1,[index2[,...]]' # syntax for local UNIX connections is '/path/to/socket:index1,[index2[,...]]' # agent = localhost:9313:remote1 # agent = localhost:9314:remote2,remote3 # agent = /var/run/searchd.sock:remote4 # blackhole remote agent, for debugging/testing # network errors and search results will be ignored # # agent_blackhole = testbox:9312:testindex1,testindex2 # remote agent connection timeout, milliseconds # optional, default is 1000 ms, ie. 1 sec # agent_connect_timeout = 1000 # remote agent query timeout, milliseconds # optional, default is 3000 ms, ie. 3 sec # agent_query_timeout = 3000 #} # realtime index example # # you can run INSERT, REPLACE, and DELETE on this index on the fly # using MySQL protocol (see 'listen' directive below) #index rt #{ # 'rt' index type must be specified to use RT index #type = rt # index files path and file name, without extension # mandatory, path must be writable, extensions will be auto-appended # path = /usr/local/coreseek/var/data/rt # RAM chunk size limit # RT index will keep at most this much data in RAM, then flush to disk # optional, default is 32M # # rt_mem_limit = 512M # full-text field declaration # multi-value, mandatory # rt_field = title # rt_field = content # unsigned integer attribute declaration # multi-value (an arbitrary number of attributes is allowed), optional # declares an unsigned 32-bit attribute # rt_attr_uint = gid # RT indexes currently support the following attribute types: # uint, bigint, float, timestamp, string # # rt_attr_bigint = guid # rt_attr_float = gpa # rt_attr_timestamp = ts_added # rt_attr_string = content #} ############################################################################# ## indexer settings ############################################################################# indexer { # memory limit, in bytes, kiloytes (16384K) or megabytes (256M) # optional, default is 32M, max is 2047M, recommended is 256M to 1024M mem_limit = 256M # maximum IO calls per second (for I/O throttling) # optional, default is 0 (unlimited) # # max_iops = 40 # maximum IO call size, bytes (for I/O throttling) # optional, default is 0 (unlimited) # # max_iosize = 1048576 # maximum xmlpipe2 field length, bytes # optional, default is 2M # # max_xmlpipe2_field = 4M # write buffer size, bytes # several (currently up to 4) buffers will be allocated # write buffers are allocated in addition to mem_limit # optional, default is 1M # # write_buffer = 1M # maximum file field adaptive buffer size # optional, default is 8M, minimum is 1M # # max_file_field_buffer = 32M } ############################################################################# ## searchd settings ############################################################################# searchd { # [hostname:]port[:protocol], or /unix/socket/path to listen on # known protocols are 'sphinx' (SphinxAPI) and 'mysql41' (SphinxQL) # # multi-value, multiple listen points are allowed # optional, defaults are 9312:sphinx and 9306:mysql41, as below # # listen = 127.0.0.1 # listen = 192.168.0.1:9312 # listen = 9312 # listen = /var/run/searchd.sock listen = 9312 #listen = 9306:mysql41 # log file, searchd run info is logged here # optional, default is 'searchd.log' log = /usr/local/coreseek/var/log/searchd.log # query log file, all search queries are logged here # optional, default is empty (do not log queries) query_log = /usr/local/coreseek/var/log/query.log # client read timeout, seconds # optional, default is 5 read_timeout = 5 # request timeout, seconds # optional, default is 5 minutes client_timeout = 300 # maximum amount of children to fork (concurrent searches to run) # optional, default is 0 (unlimited) max_children = 30 # PID file, searchd process ID file name # mandatory pid_file = /usr/local/coreseek/var/log/searchd.pid # max amount of matches the daemon ever keeps in RAM, per-index # WARNING, THERE'S ALSO PER-QUERY LIMIT, SEE SetLimits() API CALL # default is 1000 (just like Google) max_matches = 1000 # seamless rotate, prevents rotate stalls if precaching huge datasets # optional, default is 1 seamless_rotate = 1 # whether to forcibly preopen all indexes on startup # optional, default is 1 (preopen everything) preopen_indexes = 0 # whether to unlink .old index copies on succesful rotation. # optional, default is 1 (do unlink) unlink_old = 1 # attribute updates periodic flush timeout, seconds # updates will be automatically dumped to disk this frequently # optional, default is 0 (disable periodic flush) # # attr_flush_period = 900 # instance-wide ondisk_dict defaults (per-index value take precedence) # optional, default is 0 (precache all dictionaries in RAM) # # ondisk_dict_default = 1 # MVA updates pool size # shared between all instances of searchd, disables attr flushes! # optional, default size is 1M mva_updates_pool = 1M # max allowed network packet size # limits both query packets from clients, and responses from agents # optional, default size is 8M max_packet_size = 8M # crash log path # searchd will (try to) log crashed query to 'crash_log_path.PID' file # optional, default is empty (do not create crash logs) # # crash_log_path = /usr/local/coreseek/var/log/crash # max allowed per-query filter count # optional, default is 256 max_filters = 256 # max allowed per-filter values count # optional, default is 4096 max_filter_values = 4096 # socket listen queue length # optional, default is 5 # # listen_backlog = 5 # per-keyword read buffer size # optional, default is 256K # # read_buffer = 256K # unhinted read size (currently used when reading hits) # optional, default is 32K # # read_unhinted = 32K # max allowed per-batch query count (aka multi-query count) # optional, default is 32 max_batch_queries = 32 # max common subtree document cache size, per-query # optional, default is 0 (disable subtree optimization) # # subtree_docs_cache = 4M # max common subtree hit cache size, per-query # optional, default is 0 (disable subtree optimization) # # subtree_hits_cache = 8M # multi-processing mode (MPM) # known values are none, fork, prefork, and threads # optional, default is fork # workers = threads # for RT to work # max threads to create for searching local parts of a distributed index # optional, default is 0, which means disable multi-threaded searching # should work with all MPMs (ie. does NOT require workers=threads) # # dist_threads = 4 # binlog files path; use empty string to disable binlog # optional, default is build-time configured data directory # # binlog_path = # disable logging # binlog_path = /usr/local/coreseek/var/data # binlog.001 etc will be created there # binlog flush/sync mode # 0 means flush and sync every second # 1 means flush and sync every transaction # 2 means flush every transaction, sync every second # optional, default is 2 # # binlog_flush = 2 # binlog per-file size limit # optional, default is 128M, 0 means no limit # # binlog_max_log_size = 256M # per-thread stack size, only affects workers=threads mode # optional, default is 64K # # thread_stack = 128K # per-keyword expansion limit (for dict=keywords prefix searches) # optional, default is 0 (no limit) # # expansion_limit = 1000 # RT RAM chunks flush period # optional, default is 0 (no periodic flush) # # rt_flush_period = 900 # query log file format # optional, known values are plain and sphinxql, default is plain # # query_log_format = sphinxql # version string returned to MySQL network protocol clients # optional, default is empty (use Sphinx version) # # mysql_version_string = 5.0.37 # trusted plugin directory # optional, default is empty (disable UDFs) # # plugin_dir = /usr/local/sphinx/lib # default server-wide collation # optional, default is libc_ci # # collation_server = utf8_general_ci # server-wide locale for libc based collations # optional, default is C # # collation_libc_locale = ru_RU.UTF-8 # threaded server watchdog (only used in workers=threads mode) # optional, values are 0 and 1, default is 1 (watchdog on) # # watchdog = 1 # SphinxQL compatibility mode (legacy columns and their names) # optional, default is 0 (SQL compliant syntax and result sets) # # compat_sphinxql_magics = 1 } # --eof-- 求救一下 不知道哪里错了 中文搜不出结果来

使用PHP如何从mysql中检索多个日期范围并返回日期数组

<div class="post-text" itemprop="text"> <p>Table in mySQL holds hotel reservations for next few years.</p> <p>Each row contains id, start_date, end_date and status. the start_date contains a date type which represents the check-in date and the end_date is the checkout date. </p> <p>I would like to retrieve an array of individual dates so that I can loop through one year calendar and display the dates for next year that are free and which are reserved. </p> <p>Since the hotel can rent out the room again on the end_date since checkout is early, the end_date itself doesn't need to be included.</p> <p>example </p> <pre><code>ID | start_date | end_date | status 1 | 03/15/2014 | 03/18/2014 | Paid 2 | 05/22/2014 | 05/25/2014 | Deposit 3 | 08/12/2014 | 08/13/2014 | Paid </code></pre> <p>and to array:</p> <pre><code> $months_arry = array(1 =&gt; '03/15/2014', 1 =&gt; '03/16/2014', 1 =&gt; '03/17/2014', 1 =&gt; '05/22/2014', 1 =&gt; '05/23/2014', 1 =&gt; '05/24/2014', 1 =&gt; '08/12/2014'); </code></pre> <p>Since all 12 months of the calendar are displayed vertically on the same page it would be easiest to just check each date against the array to know if it should be green for vacant or red for occupied.</p> <p>In asp 3.0 on sql server i would have just created a record set rs with "</p> <pre><code>SELECT start_date, end_date from HotelBookings where start_date &gt;= '2013-12-31' AND enddate &lt;= '2015-01-01' ORDER BY start_date ASC" </code></pre> <p>then a .. do until rs.EOF loop .. inside the </p> <p>loop i would retrieve the start_date and end_date and loop them until the two are equal while adding + 1 to the start_date while building the array of individual dates.</p> <p>i found this example while looking for answer but it looks ugly and not elegant</p> <pre><code>&lt;?php // Make a MySQL Connection $query = "SELECT * FROM example"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo $row['name']. " - ". $row['age']; echo "&lt;br /&gt;"; } ?&gt; </code></pre> </div>

使用Windows索引和PHP

<div class="post-text" itemprop="text"> <p>I'm trying to get the Windows Indexing search work directly over PHP so I can search for text inside thousands of files very quickly.</p> <p>I have it working on Visual Basic with this script:</p> <pre><code>'To run this snippet, save it to a file and run it using cscript.exe from a command line. 'Running the .vbs file with Windows Script Host may cause dialog boxes to open for each item returned from the index. Set objConnection = CreateObject("ADODB.Connection") Set objRecordSet = CreateObject("ADODB.Recordset") objConnection.Open "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';" objRecordSet.Open "SELECT System.ItemName FROM SYSTEMINDEX WHERE DIRECTORY='file:C:/folderIndexed' AND CONTAINS('myDemo') ORDER BY System.ItemName DESC", objConnection Do Until objRecordset.EOF Wscript.Echo objRecordset.Fields.Item("System.ItemName") objRecordset.MoveNext Loop </code></pre> <p>Now I'm trying to port it into PHP by using the <a href="http://www.php.net/manual/en/book.com.php" rel="nofollow noreferrer">COM class</a> as suggested <a href="http://social.msdn.microsoft.com/Forums/en-US/63325b03-18f9-4506-a896-958ce55bde8a/query-windows-indexing-server-with-php?forum=sqldriverforphp" rel="nofollow noreferrer">here</a> but I'm getting this error message:</p> <blockquote> <p>com_exception<br> <b>Source:</b> Unknown<br> <b>Description:</b> Unknown</p> </blockquote> <p>My attempt looks like so:</p> <pre><code>&lt;?php $conn = new COM("ADODB.Connection") or die("Cannot start ADO"); $conn-&gt;Open("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"); $recordset = new COM("ADODB.Recordset"); $keyword = 'a'; $sql = "SELECT filename, size, path FROM SCOPE() WHERE DIRECTORY='file:C:/folderIndexed' and CONTAINS('a')"; //-----------------&gt; line of the error &lt;----------------- $recordset = $recordset-&gt;Open($sql, $conn); foreach ($recordset as $obj) { echo $obj-&gt;Fields-&gt;Item("System.filename")-&gt;Value, " " ; } </code></pre> <p>What am I doing wrong?</p> <p>I'm using PHP 5.5. and I'm using <code>extension=php_com_dotnet.dll</code> at <strong>php.ini</strong>. The php_com_dotnet.dll file is placed at the <code>ext</code> folder as detailed at the <code>extension_dir</code> value.</p> <p><br> </p><hr> <strong>Related question:</strong> <ul> <li><a href="https://stackoverflow.com/questions/21727902/empty-com-object-for-adodb-connection-with-php">https://stackoverflow.com/questions/21727902/empty-com-object-for-adodb-connection-with-php</a></li> </ul> </div>

sybase数据库配置完本地服务器 无法启动服务 急!!!WIN2003的系统

00:00000:00000:2016/10/31 01:56:37.76 kernel Registry keys for event logging are missing. 00:00000:00000:2016/10/31 01:56:37.78 kernel Checked out license ASE_DEV 00:00000:00000:2016/10/31 01:56:37.78 kernel Adaptive Server Enterprise Developer Edition. 00:00000:00000:2016/10/31 01:57:12.25 kernel Using config area from primary master device. 00:00000:00000:2016/10/31 01:57:12.26 server Configuration Error: Configuration file, 'D:\sybase\sybase\SERVERHSYWFWPT_DS2.cfg', does not exist. 00:00000:00000:2016/10/31 01:57:12.26 kernel Warning: A configuration file was not specified and the default file 'D:\sybase\sybase\SERVERHSYWFWPT_DS2.cfg' does not exist. SQL Server creates the default file with the default configuration. 00:00000:00000:2016/10/31 01:57:12.28 kernel Warning: Using default file 'D:\sybase\sybase\SERVERHSYWFWPT_DS2.cfg' since a configuration file was not specified. Specify a configuration file name in the RUNSERVER file to avoid this message. 00:00000:00000:2016/10/31 01:57:12.31 kernel Using 100000 file descriptors. 00:00000:00000:2016/10/31 01:57:12.37 kernel Adaptive Server Enterprise/12.5.4/EBF 16822 ESD#9.1/P/NT (IX86)/OS 4.0/ase1254/2146/32-bit/OPT/Wed Apr 15 04:05:47 2009 00:00000:00000:2016/10/31 01:57:12.37 kernel Confidential property of Sybase, Inc. 00:00000:00000:2016/10/31 01:57:12.37 kernel Copyright 1987, 2009 00:00000:00000:2016/10/31 01:57:12.37 kernel Sybase, Inc. All rights reserved. 00:00000:00000:2016/10/31 01:57:12.37 kernel Unpublished rights reserved under U.S. copyright laws. 00:00000:00000:2016/10/31 01:57:12.37 kernel 00:00000:00000:2016/10/31 01:57:12.37 kernel This software contains confidential and trade secret information of Sybase, 00:00000:00000:2016/10/31 01:57:12.37 kernel Inc. Use, duplication or disclosure of the software and documentation by 00:00000:00000:2016/10/31 01:57:12.37 kernel the U.S. Government is subject to restrictions set forth in a license 00:00000:00000:2016/10/31 01:57:12.37 kernel agreement between the Government and Sybase, Inc. or other written 00:00000:00000:2016/10/31 01:57:12.37 kernel agreement specifying the Government's rights to use the software and any 00:00000:00000:2016/10/31 01:57:12.37 kernel applicable FAR provisions, for example, FAR 52.227-19. 00:00000:00000:2016/10/31 01:57:12.37 kernel Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA 00:00000:00000:2016/10/31 01:57:12.37 kernel Using D:\sybase\sybase\ as the SYBASE environment variable, found during start-up 00:00000:00000:2016/10/31 01:57:12.37 kernel ASE booted on Windows 2003 build 3790 Service Pack 2.

使用cURL检索网站HTML页面,其中包含当前会话和安全页面上的cookie数据

<div class="post-text" itemprop="text"> <p>Question fully revised on: Feb. 19th </p> <h2>The thing i want (in short):</h2> <p><em>I would like to get an HTML page using cURL that is secured with a user login(at time of cURL request <strong>the user is logged in with rights to the page</strong>).</em></p> <h3>More detailed:</h3> <p>The situation is that the user is on a webpage like <code>index.php?w=2344&amp;y=lalala&amp;x=something</code> which is secured(by security script <code>class.Firewizz.Security.php</code>). On that page there is a "print as pdf" button. This sends the user to the page <code>getPDF.php</code> this page sees where the request is coming from and gets that page using cURL and that output will be send to the browser as PDF print.</p> <p>But for now i set the page variable static in the <code>getPDF.php</code> page so it does not check the referrer and i am 100% sure the page it try's to get is correct.</p> <p>Also the output is just echoed as is and is not yet converted to PDF just so that won't interfere with the problem.</p> <p>Expected output is now the same as it would be if the user goes to the page. except this is not the case, the user gets nothing.</p> <p>What do we know? We know that the <code>$_SESSION</code> data is NOT being send to the cURL, i know this for a fact because i echoed the <code>$_SESSION</code> data on the output file which says they are empty. </p> <p>After a lot of trying we still have no solution what so ever, still no '$_SESSION' data.</p> <p>I do not want to compromise security script in any way, so the solution "remove <code>ini_set('session.use_only_cookies', 1);</code> is NOT what i am looking for."</p> <p>On request(for the ones that are dedicated to help) i can send full script files but i will post relevant snippets below.</p> <p><strong><code>class.Firewizz.Security.php</code></strong></p> <pre><code>&lt;?php /* * Firewizz UserLogin */ namespace Firewizz; class Security { // Start the session, with Cookie data public function Start_Secure_Session() { // Forces sessions to only use cookies. ini_set('session.use_only_cookies', 1); // Gets current cookies params $cookieParams = session_get_cookie_params(); // Set Cookie Params session_set_cookie_params($cookieParams["lifetime"], $cookieParams["path"], $cookieParams["domain"], $this-&gt;isHTTPS, $this-&gt;deny_java_session_id); // Sets the session name session_name($this-&gt;session_name); // Start the php session session_start(); // If new session or expired, generate new id if (!isset($_SESSION['new_session'])) { $_SESSION['new_session'] = "true"; // regenerate the session, delete the old one. session_regenerate_id(true); } } // Check of user is logged in to current session, return true or false; public function LOGGED_IN() { return $this-&gt;_login_check(); } public function LOGOUT() { // Unset all session values $_SESSION = array(); // get session parameters $params = session_get_cookie_params(); // Delete the actual cookie. setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]); // Destroy session session_destroy(); if (!headers_sent()) { header("Location: " . $this-&gt;login_string, true); } else { echo '&lt;script&gt;window.location="/"&lt;/script&gt;'; } } // Must pass variables or send to login page! public function BORDER_PATROL($user_has_to_be_logged_in, $page_loaded_from_index) { $pass_border_partrol = true; if (!$this-&gt;LOGGED_IN() &amp;&amp; $user_has_to_be_logged_in) { $pass_border_partrol = false; } if (filter_input(INPUT_SERVER, "PHP_SELF") != "/index.php" &amp;&amp; $page_loaded_from_index) { $pass_border_partrol = false; } // Kick to login on fail if (!$pass_border_partrol) { $this-&gt;LOGOUT(); exit(); } } // Catch login, returns fail string or false if no errors public function CATCH_LOGIN() { if (filter_input(INPUT_POST, "id") == "login" &amp;&amp; filter_input(INPUT_POST, "Verzenden") == "Verzenden") { // Variables from form. $email = filter_input(INPUT_POST, "email"); $sha512Pass = filter_input(INPUT_POST, "p"); // Database variables $db_accounts = mysqli_connect($this-&gt;mySQL_accounts_host, $this-&gt;mySQL_accounts_username, $this-&gt;mySQL_accounts_password, $this-&gt;mySQL_accounts_database); // Prepage sql if ($stmt = $db_accounts-&gt;prepare("SELECT account_id, verified, blocked ,login_email, login_password, login_salt, user_voornaam, user_tussenvoegsel, user_achternaam FROM accounts WHERE login_email = ? LIMIT 1")) { $stmt-&gt;bind_param('s', $email); // Bind "$email" to parameter. $stmt-&gt;execute(); // Execute the prepared query. $stmt-&gt;store_result(); $stmt-&gt;bind_result($user_id, $verified, $blocked, $email, $db_password, $salt, $voornaam, $tussenvoegsel, $achternaam); // get variables from result. $stmt-&gt;fetch(); $password = hash('sha512', $sha512Pass . $salt); // hash the password with the unique salt. $tussen = ' '; if ($tussenvoegsel != "") { $tussen = " " . $tussenvoegsel . " "; } $username = $voornaam . $tussen . $achternaam; if ($stmt-&gt;num_rows == 1) { // If the user exists // Check blocked if ($blocked == "1") { return 'Deze acount is geblokkeerd, neem contact met ons op.'; } // We check if the account is locked from too many login attempts if ($this-&gt;_checkBrute($user_id, $db_accounts) == true) { // Account is locked // Send an email to user saying their account is locked return "Te vaak fout ingelogd,&lt;br /&gt;uw account is voor " . $this-&gt;blockout_time . " minuten geblokkerd."; } else { if ($db_password == $password &amp;&amp; $verified == 1) { // Password is correct!, update lastLogin if ($stmt = $db_accounts-&gt;prepare("UPDATE accounts SET date_lastLogin=? WHERE account_id=?")) { $lastlogin = date("Y-m-d H:i:s"); $stmt-&gt;bind_param('ss', $lastlogin, $user_id); // Bind "$email" to parameter. $stmt-&gt;execute(); $stmt-&gt;close(); } $ip_address = $_SERVER['REMOTE_ADDR']; // Get the IP address of the user. $user_browser = $_SERVER['HTTP_USER_AGENT']; // Get the user-agent string of the user. $user_id = preg_replace("/[^0-9]+/", "", $user_id); // XSS protection as we might print this value $_SESSION['user_id'] = $user_id; $username = $username; // XSS protection as we might print this value $_SESSION['username'] = $username; $_SESSION['login_string'] = hash('sha512', $password . $ip_address . $user_browser); // Login successful. if ($this-&gt;MailOnLogin != FALSE) { mail($this-&gt;MailOnLogin, 'SECUREPLAY - LOGIN', $username . ' logged in to the secureplay platform..'); } return false; } else { // Password is not correct // We record this attempt in the database $now = time(); $db_accounts-&gt;query("INSERT INTO login_attempts (userID, timestamp) VALUES (" . $user_id . ", " . $now . ")"); return "Onbekende gebruikersnaam en/of wachtwoord."; } } } else { return "Onbekende gebruikersnaam en/of wachtwoord."; } } else { return 'SQL FAIL! ' . mysqli_error($db_accounts); } return "Onbekende fout!"; } return false; } private function _checkBrute($user_id, $db_accounts) { // Get timestamp of current time $now = time(); // All login attempts are counted from the past 2 hours. $valid_attempts = $now - ($this-&gt;blockout_time * 60); if ($stmt = $db_accounts-&gt;prepare("SELECT timestamp FROM login_attempts WHERE userID = ? AND timestamp &gt; $valid_attempts")) { $stmt-&gt;bind_param('i', $user_id); // Execute the prepared query. $stmt-&gt;execute(); $stmt-&gt;store_result(); // If there has been more than 5 failed logins if ($stmt-&gt;num_rows &gt; $this-&gt;max_login_fails) { return true; } else { return false; } } else { return true; } } // Login Check if user is logged in correctly private function _login_check() { // Database variables $db_accounts = mysqli_connect($this-&gt;mySQL_accounts_host, $this-&gt;mySQL_accounts_username, $this-&gt;mySQL_accounts_password, $this-&gt;mySQL_accounts_database); // Check if all session variables are set if (isset($_SESSION['user_id'], $_SESSION['username'], $_SESSION['login_string'])) { $user_id = $_SESSION['user_id']; $login_string = $_SESSION['login_string']; $username = $_SESSION['username']; $ip_address = $_SERVER['REMOTE_ADDR']; // Get the IP address of the user. $user_browser = $_SERVER['HTTP_USER_AGENT']; // Get the user-agent string of the user. if ($stmt = $db_accounts-&gt;prepare("SELECT login_password FROM accounts WHERE account_id = ? LIMIT 1")) { $stmt-&gt;bind_param('i', $user_id); // Bind "$user_id" to parameter. $stmt-&gt;execute(); // Execute the prepared query. $stmt-&gt;store_result(); if ($stmt-&gt;num_rows == 1) { // If the user exists $stmt-&gt;bind_result($password); // get variables from result. $stmt-&gt;fetch(); $login_check = hash('sha512', $password . $ip_address . $user_browser); if ($login_check == $login_string) { // Logged In!!!! return $user_id; } else { // Not logged in return false; } } else { // Not logged in return false; } } else { // Not logged in //die("f3"); return false; } } else { // Not logged in return false; } } } </code></pre> <p><strong><code>secured_page</code></strong></p> <pre><code>&lt;?php require_once 'assets/class.Firewizz.Security.php'; if (!isset($SECURITY)) { $SECURITY = new Firewizz\Security(); } // Check if user is logged in or redirect to login page; $SECURITY-&gt;BORDER_PATROL(true, true); // CONTENT bla bla ?&gt; </code></pre> <p><strong><code>getPDF.php</code></strong></p> <pre><code>&lt;?php // Requires require_once 'assets/class.FirePDF.php'; require_once 'assets/class.Firewizz.Security.php'; $SECURITY = new \Firewizz\Security(); $SECURITY-&gt;Start_Secure_Session(); // Html file to scrape, if this works replace with referer so the page that does the request gets printed.(prepend by security so it can only be done from securePlay $html_file = 'http://www.website.nl/?p=overzichten&amp;sort=someSort&amp;s=67'; // Output pdf filename $pdf_fileName = 'Test_Pdf.pdf'; /* * cURL part */ // create curl resource $ch = curl_init(); // set source url curl_setopt($ch, CURLOPT_URL, $html_file); // set cookies $cookiesIn = "user_id=" . $_SESSION['user_id'] . "; username=" . $_SESSION['username'] . "; login_string=" . $_SESSION['login_string'] . ";"; // set cURL Options $tmp = tempnam("/tmp", "CURLCOOKIE"); if ($tmp === FALSE) { die('Could not generate a temporary cookie jar.'); } $options = array( CURLOPT_RETURNTRANSFER =&gt; true, // return web page //CURLOPT_HEADER =&gt; true, //return headers in addition to content CURLOPT_ENCODING =&gt; "", // handle all encodings CURLOPT_AUTOREFERER =&gt; true, // set referer on redirect CURLOPT_CONNECTTIMEOUT =&gt; 120, // timeout on connect CURLOPT_TIMEOUT =&gt; 120, // timeout on response CURLOPT_MAXREDIRS =&gt; 10, // stop after 10 redirects CURLINFO_HEADER_OUT =&gt; true, CURLOPT_SSL_VERIFYPEER =&gt; false, // Disabled SSL Cert checks CURLOPT_HTTP_VERSION =&gt; CURL_HTTP_VERSION_1_1, CURLOPT_COOKIEJAR =&gt; $tmp, //CURLOPT_COOKIEFILE =&gt; $tmp, CURLOPT_COOKIE =&gt; $cookiesIn ); // $output contains the output string curl_setopt_array($ch, $options); $output = curl_exec($ch); // close curl resource to free up system resources curl_close($ch); // output the cURL echo $output; ?&gt; </code></pre> <h3>How we test</h3> <p>Current testing is done by logging the user in and going to the correct page we want to get with cURL and verifying he sees the page(which works). Now we run the <code>getPDF.php</code> page in a new tab. in which we see a blank page due to the security failure. if we add <code>echo "session data:" . $_SESSION["login_string"]</code>; in the security script we see the variables in the $_SESSION is blank. When we paste the same line in the <code>getPDF.php</code> we see it is being set there. So we know for a fact is has not been transferred by cURL.</p> <h3>Some short information.</h3> <ul> <li>So with above code we get a blank page;</li> <li>$_SESSION data not send;</li> <li>Pretty sure cookies not send either;</li> <li>Tried various cURL setups, none with success all the same;</li> <li>Would be perfect if ALL $_SESSION AND $_COOKIE data is passed;</li> <li>Tried everything said in comments or answers.</li> </ul> </div>

使用angular.js和PHP从数据库中检索数据

<div class="post-text" itemprop="text"> <p>I need to retrieve all my data from database and bind them in text-field using angular.js and PHP. I am explaining my code below.</p> <blockquote> <p>index.php</p> </blockquote> <pre><code>&lt;?php include_once 'dbconfig.php'; ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;CRUD Operations With PHP and MySql - By Cleartuts&lt;/title&gt; &lt;link rel="stylesheet" href="css/style.css" type="text/css" /&gt; &lt;/head&gt; &lt;body&gt; &lt;center&gt; &lt;div id="body"&gt; &lt;div id="content"&gt; &lt;table align="center"&gt; &lt;tr&gt; &lt;th colspan="5"&gt;&lt;a href="add_data.html"&gt;add data here.&lt;/a&gt;&lt;/th&gt; &lt;/tr&gt; &lt;th&gt;First Name&lt;/th&gt; &lt;th&gt;Last Name&lt;/th&gt; &lt;th&gt;City Name&lt;/th&gt; &lt;th colspan="2"&gt;Operations&lt;/th&gt; &lt;/tr&gt; &lt;?php $sql_query="SELECT * FROM users"; $result_set=mysql_query($sql_query); while($row=mysql_fetch_row($result_set)) { ?&gt; &lt;tr&gt; &lt;td&gt;&lt;?php echo $row[1]; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row[2]; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row[3]; ?&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;a href="edit_data.php?edt_id=&lt;?php echo urlencode($row[0]) ?&gt;"&gt;&lt;img src="images/pencil_small.png" align="EDIT" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;a href="javascript:delete_id('&lt;?php echo $row[0]; ?&gt;')"&gt;&lt;img src="images/cross-small-icon.png" align="DELETE" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php } ?&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/center&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>When user will click on edit button it will redirect to the next page(<code>i.e-edit_data.php</code>) which is given below and this page contains all the data which are going to be edited.</p> <blockquote> <p>edit_data.php:</p> </blockquote> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" ng-app="edit_data"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;CRUD Operations With PHP and MySql - By Cleartuts&lt;/title&gt; &lt;link rel="stylesheet" href="css/style.css" type="text/css" /&gt; &lt;script src="js/angularjs.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="js/update.js" type="text/javascript"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;center ng-controller="updateController"&gt; &lt;div id="body"&gt; &lt;div id="content"&gt; &lt;table align="center"&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="text" name="first_name" placeholder="First Name" ng-model="first_name" required /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="text" name="last_name" placeholder="Last Name" ng-model="last_name" required /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="text" name="city_name" placeholder="City" ng-model="city" required /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;button type="submit" name="btn-update" ng-click="update_data();"&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/button&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/center&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>In this page i need to display all fetched data inside text-field.</p> <blockquote> <p>update.js:</p> </blockquote> <pre><code>var app=angular.module("edit_data", []); app.controller("updateController",function($scope,$http){ $scope.errors = []; $scope.msgs = []; $scope.update_data=function(){ $http.post('js/update.php',{"first_name":$scope.first_name,"last_name":$scope.last_name,"city":$scope.city} ).success(function(data, status, headers, config){ if(data.msg!=''){ $scope.msgs.push(data.msg); }else{ $scope.errors.push(data.error); } }).error(function(data, status) { // called asynchronously if an error occurs // or server returns response with an error status. $scope.errors.push(status); }); } }); </code></pre> <p>I need to retrieve these three data <code>first_name,last_name,user_city</code> from my Mysql database.Please help me to resolve this issue.</p> </div>

使用PHP和AJAX从MySQL数据库中选择和检索数据

<div class="post-text" itemprop="text"> <p>I'm trying to select data from a MySQL database that is hosted on a webserver. I want to be able to retrieve the data from a table within the database and then illustrate it within a HTML table. There's an example on W3Schools that I've been following, but I'm unable to retrieve the data successfully.</p> <p>Below is the source code: (HTML)</p> <pre><code>&lt;html&gt; &lt;head&gt; //Javascript code &lt;script&gt; function showUser(str) { if (str == "") { document.getElementById("txtHint").innerHTML = ""; return; } else { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if (this.readyState == 4 &amp;&amp; this.status == 200) { document.getElementById("txtHint").innerHTML = this.responseText; } }; xmlhttp.open("GET","getuser.php?q="+str,true); xmlhttp.send(); } } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form&gt; &lt;select name="users" onchange="showUser(this.value)"&gt; &lt;option value=""&gt;Select a person:&lt;/option&gt; &lt;option value="1"&gt;Peter Griffin&lt;/option&gt; &lt;option value="2"&gt;Lois Griffin&lt;/option&gt; &lt;option value="3"&gt;Joseph Swanson&lt;/option&gt; &lt;option value="4"&gt;Glenn Quagmire&lt;/option&gt; &lt;/select&gt; &lt;/form&gt; &lt;br&gt; &lt;div id="txtHint"&gt;&lt;b&gt;Person info will be listed here...&lt;/b&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>PHP File: (getuser.phd)</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;style&gt; table { width: 100%; border-collapse: collapse; } table, td, th { border: 1px solid black; padding: 5px; } th {text-align: left;} &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;?php $q = intval($_GET['q']); $con = mysqli_connect(‘www.example.com’,’user_Admin’,’12345-678’,’my_DB'); if (!$con) { die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,"ajax_demo"); $sql="SELECT * FROM user WHERE id = '".$q."'"; $result = mysqli_query($con,$sql); echo "&lt;table&gt; &lt;tr&gt; &lt;th&gt;Firstname&lt;/th&gt; &lt;th&gt;Lastname&lt;/th&gt; &lt;th&gt;Age&lt;/th&gt; &lt;th&gt;Hometown&lt;/th&gt; &lt;th&gt;Job&lt;/th&gt; &lt;/tr&gt;"; while($row = mysqli_fetch_array($result)) { echo "&lt;tr&gt;"; echo "&lt;td&gt;" . $row['FirstName'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['LastName'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['Age'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['Hometown'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['Job'] . "&lt;/td&gt;"; echo "&lt;/tr&gt;"; } echo "&lt;/table&gt;"; mysqli_close($con); ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I think the issue might exist from <strong>mysqli_select_db($con,"ajax_demo");</strong> onwards inside the PHP file. Should I be referring to the table that contains the data inside the database?</p> <p>I have the PHP File hosted on my webserver, so I'm not sure why it won't retrieve that data when a person is selected from the list of options on the HTML page.</p> <p>Any help would be much appreciated. </p> </div>

试图获取非对象和未定义索引错误的属性

<div class="post-text" itemprop="text"> <p>I just migrated a site based on custom CMS to new server. After migrating I am getting notices and warnings all over the admin area where content can be edited. </p> <pre><code>Notice: Trying to get property of non-object in database.php on line 69 Notice: Undefined index: in database.php on line 69 </code></pre> <p>Following are the functions which are being used in the process:</p> <pre><code>function dbQuerySafener($query,$params=false) { $link= db_connect(); if ($params) { foreach ($params as &amp;$v) { $v = mysqli_real_escape_string($link,$v); } $sql_query = vsprintf( str_replace("?","'%s'",$query), $params ); } else { $sql_query = $query; } return $sql_query; } // query returning ARRAY (many rows) function dbArray($query,$params=false) { $link= db_connect(); $table_result=array(); $r=0; $sql = dbQuerySafener($query, $params); $result = mysqli_query($link,$sql) or die(mysqli_error($link)." &lt;br&gt;".$sql); while($row = mysqli_fetch_assoc($result)) { $arr_row=array(); $c=0; while ($c &lt; mysqli_num_fields($result)) { $col = mysqli_fetch_field($result); $arr_row[$col -&gt; name] = $row[$col -&gt; name]; // line 69 $c++; } $table_result[$r] = $arr_row; $r++; } return $table_result; } </code></pre> <p>It is working as follows: A sql query will be passed to dbArray function, for example: </p> <pre><code> $sql = "SELECT `id`, `emailAddress`, `name` FROM `gcms_users` WHERE `active`=?"; $data = dbArray($sql, array(1)); </code></pre> <p>EXPECTED RESULT: The above two functions will fetch the results from database which should contains field name and its value, example:</p> <pre><code> Array ( [0] =&gt; Array ( [id] =&gt; 1 [emailAddress] =&gt; admin@email.com [name] =&gt; John ) [1] =&gt; Array ( [id] =&gt; 1 [emailAddress] =&gt; paul@email.com [name] =&gt; Paul ) ) </code></pre> <p>ACTUAL RESULT:</p> <pre><code> Array ( [0] =&gt; Array ( [id] =&gt; 1 [emailAddress] =&gt; admin@email.com [name] =&gt; John ) [1] =&gt; Array ( [] =&gt; ) ) </code></pre> <p>There is some problem with dbArray() function while fetching the rows but I am not getting that what is missing here. Your help will be highly appreciated.</p> <p>Thank you.</p> </div>

图像未更新且未检索

<div class="post-text" itemprop="text"> <p>I want to store an image in database.I tried by using inserting query but by updating (by using UPDATE query) is not working. And also retrieving query not working.I want to retrieve image at three places.</p> <p>And here's my code... everything else is updated and retrieved successfully but it's not storing and retrieve image..please help me to solve the problem.. I'm using long blob data type to store image.</p> <p>Update is done in PersonalDetails modal.Here is my modal and its php code. </p> <p><code>StudentProfile.php</code> (retrieve is need to do in both card and modal)</p> <p></p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php // Initialize the session session_start(); // Include Connection file require_once 'Connection.php'; //define variables include('Variables.php'); //define variables for errors $first_name_err=$middle_name_err=$last_name_err=$admitted_date_err=$academic_year_err=$course_err=$dob_err=$nic_err=$gender_err=$nationality_err=$religion_err=$race_err=""; //Create select query for retrieving data $sql = "SELECT personal_details.*,contact_details.*,academic_details.*,extra_curricular_activities.* FROM personal_details JOIN contact_details ON personal_details.Student_ID = contact_details.Student_ID JOIN academic_details ON personal_details.Student_ID = academic_details.Student_ID JOIN extra_curricular_activities ON personal_details.Student_ID = extra_curricular_activities.Student_ID WHERE personal_details.Student_ID = '{$_SESSION['student_id']}'"; //Check query $result = $connection-&gt;query($sql); if ($result-&gt;num_rows &gt; 0) { // output data of each row while($row = $result-&gt;fetch_assoc()) { //Include Row File include('Row.php'); } } else { echo "No results found"; } //Close connection $connection-&gt;close(); ?&gt; //card //Image need to retrieve here &lt;div class="col-3"&gt; &lt;?php echo '&lt;img src="data:image/jpeg;base64,'.base64_encode($profile_picture).'" height="200" width="200" /&gt;';?&gt; &lt;/div&gt; &lt;div class="col-9"&gt; //modal &lt;!--Model body--&gt; &lt;form action="PersonalDetails.php" method="post" enctype="multipart/form-data"&gt; &lt;div class="modal-body mx-3"&gt; &lt;div class="row"&gt; &lt;div class="md-form col-6"&gt; &lt;?php echo '&lt;img src="data:image/jpeg;base64,'.base64_encode($profile_picture).'" height="200" width="200" class="img-thumnail" /&gt;';?&gt;&lt;br&gt;&lt;br&gt; &lt;div class="custom-file"&gt; &lt;input type="file" name="profile_picture" class="custom-file-input" id="inputGroupFile01" aria-describedby="inputGroupFileAddon01"&gt; &lt;label class="custom-file-label" for="inputGroupFile01"&gt;&lt;/label&gt; &lt;/div&gt; &lt;/div&gt;</code></pre> </div> </div> <p><strong>PersonalDetails.php</strong></p> <p></p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php // Initialize the session session_start(); // Include Connection file require_once 'Connection.php'; //define variables include('Variables.php'); //define variables for errors $first_name_err=$middle_name_err=$last_name_err=$admitted_date_err=$academic_year_err=$course_err=$dob_err=$nic_err=$gender_err=$nationality_err=$religion_err=$race_err=""; function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } if(isset($_POST["save"])){ // Processing form data when form is submitted if($_SERVER["REQUEST_METHOD"] == "POST"){ // Validate input fields if(empty(trim($_POST['first_name'])) || empty(trim($_POST['middle_name'])) || empty(trim($_POST['last_name'])) || empty(trim($_POST['admitted_date'])) || empty(trim($_POST['academic_year'])) || empty(trim($_POST['course'])) || empty(trim($_POST['dob'])) || empty(trim($_POST['nic'])) || empty(trim($_POST['gender'])) || empty(trim($_POST['nationality'])) || empty(trim($_POST['religion'])) || empty(trim($_POST['race'])) ){ $_SESSION['empty'] = "Mandatory fields are missing.Please fill the empty fields."; header('location: StudentProfile.php'); } $first_name = test_input($_POST['first_name']); $middle_name = test_input($_POST['middle_name']); $last_name = test_input($_POST['last_name']); // check if Name only contains letters and whitespace if (!preg_match("/^[a-zA-Z ]*$/",$first_name) || !preg_match("/^[a-zA-Z ]*$/",$middle_name) || !preg_match("/^[a-zA-Z ]*$/",$last_name)) { $_SESSION['charachter']= "Only letters and white space allowed"; header('location: StudentProfile.php'); } // Check input errors before inserting in database if(empty($_SESSION['empty']) &amp;&amp; empty($_SESSION['charachter']) ){ // Prepare a select statement $sql = "SELECT * FROM personal_details WHERE Student_ID = '{$_SESSION['student_id']}'"; $result = $connection-&gt;query($sql); // Check if student id exists, if yes then create update query if($result-&gt;num_rows &gt; 0){ $file = addslashes(file_get_contents($_FILES["profile_picture"]["tmp_name"])); $sql="UPDATE personal_details SET Profile_Picture='$file', First_Name='$first_name', Middle_Name='$middle_name', Last_Name='$last_name', Admitted_Date='$admitted_date', Academic_Year='$academic_year', Course='$course', DOB='$dob', NIC='$nic', Gender='$gender', Nationality='$nationality', Religion='$religion', Race='$race' WHERE Student_ID='{$_SESSION['student_id']}'"; if ($connection-&gt;query($sql) === TRUE) { $_SESSION['success'] = "Updated Successfully!!"; header('location: StudentProfile.php'); } else { $_SESSION['error'] = "Error: " . $sql . "&lt;br&gt;" . $connection-&gt;error; } } else{ $file = addslashes(file_get_contents($_FILES["profile_picture"]["tmp_name"])); $allowed = array("jpeg","jpg","png"); // Create a insert query if student id doesn't exist $sql= "INSERT INTO personal_details(Student_ID,Profile_Picture,First_Name,Middle_Name,Last_Name,Admitted_Date,Academic_Year,Course,DOB,NIC,Gender,Nationality,Religion,Race) VALUES ('{$_SESSION['student_id']}','$file','$first_name','$middle_name','$last_name','$admitted_date','$academic_year','$course','$dob','$nic','$gender','$nationality','$religion','$race')"; if ($connection-&gt;query($sql) === TRUE) { $_SESSION['success'] = "Submitted Successfully!!"; header('location: StudentProfile.php'); } else { $_SESSION['error'] = "Error: " .$sql."&lt;br&gt;". $connection-&gt;error; } } } } } $connection-&gt;close(); ?&gt;</code></pre> </div> </div> </div>

mysql宕机求高手指教原因

============== my.ini配置 START ============== # Example MySQL config file for medium systems. # # This is for a system with little memory (32M - 64M) where MySQL plays # an important part, or systems up to 128M where MySQL is used together with # other programs (such as a web server) # # You can copy this file to # /etc/my.cnf to set global options, # mysql-data-dir/my.cnf to set server-specific options (in this # installation this directory is C:\mysql\data) or # ~/.my.cnf to set user-specific options. # # In this file, you can use all long options that a program supports. # If you want to know which options a program supports, run the program # with the "--help" option. # The following options will be passed to all MySQL clients [client] #password = your_password port = 3306 socket = /tmp/mysql.sock # Here follows entries for some specific programs # The MySQL server [mysqld] port = 3306 socket = /tmp/mysql.sock skip-locking key_buffer = 16M max_allowed_packet = 10M table_cache = 128 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 64M max_connections = 1000 default-character-set = utf8 thread_cache_size = 8 query_cache_size = 0 query_cache_type = 0 # Don't listen on a TCP/IP port at all. This can be a security enhancement, # if all processes that need to connect to mysqld run on the same host. # All interaction with mysqld must be made via Unix sockets or named pipes. # Note that using this option without enabling named pipes on Windows # (via the "enable-named-pipe" option) will render mysqld useless! # #skip-networking # Disable Federated by default skip-federated # Replication Master Server (default) # binary logging is required for replication log-bin=mysql-bin # binary logging format - mixed recommended binlog_format=mixed # required unique id between 1 and 2^32 - 1 # defaults to 1 if master-host is not set # but will not function as a master if omitted server-id = 1 # Replication Slave (comment out master section to use this) # # To configure this host as a replication slave, you can choose between # two methods : # # 1) Use the CHANGE MASTER TO command (fully described in our manual) - # the syntax is: # # CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>, # MASTER_USER=<user>, MASTER_PASSWORD=<password> ; # # where you replace <host>, <user>, <password> by quoted strings and # <port> by the master's port number (3306 by default). # # Example: # # CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT= 3306, # MASTER_USER='joe', MASTER_PASSWORD='secret'; # # OR # # 2) Set the variables below. However, in case you choose this method, then # start replication for the first time (even unsuccessfully, for example # if you mistyped the password in master-password and the slave fails to # connect), the slave will create a master.info file, and any later # change in this file to the variables' values below will be ignored and # overridden by the content of the master.info file, unless you shutdown # the slave server, delete master.info and restart the slaver server. # For that reason, you may want to leave the lines below untouched # (commented) and instead use CHANGE MASTER TO (see above) # # required unique id between 2 and 2^32 - 1 # (and different from the master) # defaults to 2 if master-host is set # but will not function as a slave if omitted #server-id = 2 # # The replication master for this slave - required #master-host = <hostname> # # The username the slave will use for authentication when connecting # to the master - required #master-user = <username> # # The password the slave will authenticate with when connecting to # the master - required #master-password = <password> # # The port the master is listening on. # optional - defaults to 3306 #master-port = <port> # # binary logging - not required for slaves, but recommended #log-bin=mysql-bin # Point the following paths to different dedicated disks #tmpdir = /tmp/ #log-update = /path-to-dedicated-directory/hostname # Uncomment the following if you are using InnoDB tables #innodb_data_home_dir = C:\mysql\data/ #innodb_data_file_path = ibdata1:10M:autoextend #innodb_log_group_home_dir = C:\mysql\data/ # You can set .._buffer_pool_size up to 50 - 80 % # of RAM but beware of setting memory usage too high #innodb_buffer_pool_size = 16M #innodb_additional_mem_pool_size = 2M # Set .._log_file_size to 25 % of buffer pool size #innodb_log_file_size = 5M #innodb_log_buffer_size = 8M #innodb_flush_log_at_trx_commit = 1 #innodb_lock_wait_timeout = 50 [mysqldump] quick max_allowed_packet = 10M [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [isamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [myisamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout ============== my.ini配置 END ============== ============== mysql 错误日志 START ============== 180120 18:16:36 InnoDB: Starting shutdown... 180120 18:16:38 InnoDB: Shutdown completed; log sequence number 2 1119799076 180120 18:16:38 [Warning] Forcing shutdown of 1 plugins 180120 18:16:38 [Note] D:\PHPnow-1.5.3\MySQL-5.1.33\bin\mysqld.exe: Shutdown complete 180120 18:16:39 InnoDB: Started; log sequence number 2 1119799076 180120 18:16:39 [Note] Event Scheduler: Loaded 0 events 180120 18:16:39 [Note] D:\PHPnow-1.5.3\MySQL-5.1.33\bin\mysqld.exe: ready for connections. Version: '5.1.33-community-log' socket: '' port: 3306 MySQL Community Server (GPL) 180120 21:12:28 - mysqld got exception 0xc0000005 ; This could be because you hit a bug. It is also possible that this binary or one of the libraries it was linked against is corrupt, improperly built, or misconfigured. This error can also be caused by malfunctioning hardware. We will try our best to scrape up some info that will hopefully help diagnose the problem, but since we have already crashed, something is definitely wrong and this may fail. key_buffer_size=8388608 read_buffer_size=262144 max_used_connections=43 max_threads=1000 threads_connected=20 It is possible that mysqld could use up to key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 782496 K bytes of memory Hope that's ok; if not, decrease some variables in the equation. thd: 0x37f7930 Attempting backtrace. You can use the following information to find out where mysqld died. If you see no messages after this, something went terribly wrong... 00725584 mysqld.exe!??? 004E6C5A mysqld.exe!??? Trying to get some variables. Some pointers may be invalid and cause the dump to abort... thd->query at 05CE2E30=select * from massage_common_user where yn=1 and id=29156 thd->thread_id=8430 thd->killed=NOT_KILLED The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains information that should help you find out what is causing the crash. InnoDB: Log scan progressed past the checkpoint lsn 2 1125547569 180120 21:14:56 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... InnoDB: Doing recovery: scanned up to log sequence number 2 1125550276 180120 21:14:56 InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percents: 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 InnoDB: Apply batch completed InnoDB: Last MySQL binlog file position 0 4956330, file name .\mysql-bin.000053 180120 21:14:57 InnoDB: Started; log sequence number 2 1125550276 180120 21:14:57 [Note] Recovering after a crash using mysql-bin 180120 21:14:57 [Note] Starting crash recovery... 180120 21:14:57 [Note] Crash recovery finished. 180120 21:14:57 [Note] Event Scheduler: Loaded 0 events 180120 21:14:57 [Note] D:\PHPnow-1.5.3\MySQL-5.1.33\bin\mysqld.exe: ready for connections. Version: '5.1.33-community-log' socket: '' port: 3306 MySQL Community Server (GPL) ============== mysql 错误日志 END ============== 服务器环境 window server 2012 16G

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

ArrayList源码分析(入门篇)

ArrayList源码分析 前言: 写这篇博客的主要原因是,在我上一次参加千牵科技Java实习生面试时,有被面试官问到ArrayList为什么查找的速度较快,插入和删除的速度较慢?当时我回答得不好,很大的一部分原因是因为我没有阅读过ArrayList源码,虽然最后收到Offer了,但我拒绝了,打算寒假学得再深入些再广泛些,下学期开学后再去投递其他更好的公司。为了更加深入理解ArrayList,也为

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

玩转springboot启动banner定义所得

最近接手了一个springboot项目,不是不熟悉这个框架,启动时打印的信息吸引了我。 这不是我熟悉的常用springboot的打印信息啊,我打开自己的项目: 还真是的,不用默认的感觉也挺高大上的。一时兴起,就去研究了一下源代码,还正是有些收获,稍后我会总结一下。正常情况下做为一个老程序员,是不会对这种小儿科感兴趣的,不就是一个控制台打印嘛。哈哈! 于是出于最初的好奇,研究了项目的源代码。看到

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

Java岗开发3年,公司临时抽查算法,离职后这几题我记一辈子

前几天我们公司做了一件蠢事,非常非常愚蠢的事情。我原以为从学校出来之后,除了找工作有测试外,不会有任何与考试有关的事儿。 但是,天有不测风云,公司技术总监、人事总监两位大佬突然降临到我们事业线,叫上我老大,给我们组织了一场别开生面的“考试”。 那是一个风和日丽的下午,我翘着二郎腿,左手端着一杯卡布奇诺,右手抓着我的罗技鼠标,滚动着轮轴,穿梭在头条热点之间。 “淡黄的长裙~蓬松的头发...

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

立即提问
相关内容推荐