Label:Http://blog.sina.com.cn/s/blog_621768f30100r6v7.htmlConvert database records into JSON format(2011-03-13 19:48:37) reproduced
Tags: gossip
/1. Remove 10 data from the Company data user table and save the array2. When converting an array to JSON format, pass it to JS3. Use the JSON parser to convert the passed JSON string
This article mainly introduces the simple example of outputting database query results in json format in PHP. This article provides sample code directly, which is a very basic method. you should understand it at a glance, for more information, see include/conn. php is a database linked file and cannot be searched online
Tutorial provided by the first php networ
This article mainly introduces how to modify columns in Date format in mysql database. For more information, see
Import java. SQL. *; import java. text. dateFormat; // query public class SelectTable {String dbDriver = "com. mysql. jdbc. driver "; String dbUrl =" jdbc: mysql: // localhost: 3306/sss "; // String username =" root "; String password =" 123 "based on actual conditions "; public Connection getCon
Data | Databases often see people asking questions about time formats, such as incorrect time formats from a database that fit your heart. Because of the difference between the operating system and the database version, this problem does exist. Some people like to be in the data from the database after the definition of type, I think this does not grasp the sourc
Problem: There are two Web servers in the production environment, 227 and 228 respectively, the application code deployed is synchronized daily, the two sides are exactly the same, but some pages query data, 227 no results, and the background report the Java array out of bounds error, and 2,281 tangent normal. After the developer to adjust the page program, add fault-tolerant processing, 227 of the query returned to normal, but the query results in the date value is displayed in English, and 228
A common database JDBC URL format 1 sqlite driver package Name: Sqlitejdbc-v056.jar Driver class Name: Org.sqlite.JDBCJDBC url:jdbc:sqlite:c:\*.db default Port No NBSP;2 Microsoft SQL Servermicrosoft SQL Server JDBC Driver (typically used to connect to SQL Server) driver package name: Msbase.jar Mssqlserver.ja R Msutil.jar Driver class name: Com.microsoft.jdbc.sqlserver.SQLServerDriverJDBC url:jdbc:micros
Converts the date format of a database. It is enough to specify the date format in convert, such as: selectconvert (char (20), getdate (), 101) selectemp_id, convert (char (20), hire_dt, 101) fromemployee ----------------------- you only need to specify the date format code in convert, such:
Select convert (char (20),
PHP uses the PDO method to convert Mysql data to a function in the SQLite form. Recently, a function is used to convert mysql data to sqlite data, because we want to save the image data in blob binary format, I will write a class myself. from the class, I will extract this method to share it. In order to continue working normally in the future, I used the PDO method for processing.
/*** Create SQlite * $ db data
=password (' 123123 ');Allow Remote login settings
Change a user's password
UPDATE user Set Password=password (' 123456 ') whereuser= "root";
Update user Setpassword=password (' 123456 ') where user= "root";
Change the host limit for remote logins
Update user set host= '% ' whereuser= "root" and host= ' localhost ';
refresh authorization Flush privileges; set boot from boot ( 7 6 version difference is larger) systemctl enablemysql 7 chkconfigmysql on The location
" Set Curtime=06if " %curtime% "= =" 7 "Set curtime=07if"%curtime% "= =" 8 "Set curtime=08if"%curtime% "= =" 9 "Set Curtime=09set curtime=%curtime% %time:~3,2%%time:~6,2%rem set all, username, and password set owner=xxx (write your database service name here) set User=xxx (a corresponding user of the database you want to back up) set Password=xxx (corresponding PASSWORD) REM create a backup folder.
Php outputs the http address in the database and the format changes. how can this problem be solved? I know that we can use str_replace to replace \ With '', but this will also cause problems, if the data in json format contains Chinese characters, the \ asd5 of Chinese characters will be changed to asd5 .. Is there any other way to solve this problem?
Reply
How does PHP write to the database according to format and read it???
HTML Code
When: postdb[sku_name][1_50]= black postdb[sku_sku][1_50]=m postdb[sku_price][1_50]=100 postdb[sku_shopid][1_50]=1000 p Ostdb[sku_storage][1_50]=mj1 postdb[sku_name][1_55]= Yellow postdb[sku_sku][1_55]=x postdb[sku_price][1_55]=77 postdb[ sku_shopid][1_55]=1000 postdb[sku_storage][1_55]=mj2postdb[sku_name][7_60]
If you put the HTML into the database, if you need to edit the article again, you can't do it.
If you store markdown,
When the article is displayed, you need to format the article, if the backend uses Markdown parsing and the Markdown Editor standard is not the same, but also prone to problems
The backend needs an extra distinction between articles published with the Rich text editor and artic
Tags: query datetime rem from Ted not accept sage tablesThere was an error when the date data in the XML Schema format was stored in the DateTime field in the database Mysql> SELECT @ @sql_mode; +--------------------------------------------+
|
@ @sql_mode | +--------------------------------------------+
|
strict_trans_tables,no_engine_substitution | +--------------------------------------------+ 1 row in Se
In many cases, the provincial/municipal (district) level-2 linkage drop-down menus, such as address information and weather API calls, are used during Website Development. They are also universal, A warehouse is used everywhere. this method has been mentioned in the previous articles in Nongfu Manor. However, the provincial and municipal information found on the Internet is poor. many cities at the county level are listed in the district city, and will be deleted later, it was quite troublesome.
When you need to develop and output HTML reports in the database, you can directly use the htp package during the process to implement HTML code and output after data processing. and the output is in the desired format (controlled by the HTML Markup Language ). the following is a test example for generating HTML reports directly from a database. You need to modif
In the development process, we often save the number of milliseconds in the date and time to the database, but the corresponding time seems very inconvenient, some functions can be used to convert data in milliseconds to the date format.
1. in MySQL, there is a built-in function from_unixtime () for conversion, using the following:
Mysql> select from_unixtime (1, '% Y-% m-% d % H: % I: % S ');
+ --------
Select To_date (' 2010-10-20 13:23:44 ', ' yyyy-mm-dd hh24:mi:ss ') DateTime from dual;Display results: 2010/10/20 13:23:44 Select To_date (' 2010-10-20 13:23:44 ', ' yyyy/mm/dd hh24:mi:ss ') DateTime from dual; Display results: 2010/10/20 13:23:44 Select To_char (to_date (222, ' J '), ' JSP ') from dual; Displaying results: Hundred Twenty-two If you follow the example below, you will get an error: ORA-01849: The hour value must be between 1 and 12. (Because the HH is 12 binary, no 13 error) S
Label:When the amount of text data is relatively large, the input of a strip is basically impossible, and writing a program to relay it is also very troublesome, fortunately SQL Server provides a relatively concise method.Bulk Insert table name from ' C + + your text file. txt ' with (fieldterminator = ' What symbol to split the data ', rowterminator= ' with what symbol plus \ n End ') --\n is the meaning of a carriage return, is the carriage return front is what symbol, if unsigned direct sing
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.