Most anwered "mysql" questions
Mysql is a relational database management system (RDBMS) that functions as a server, and provides access to multiple users simultaneously. Your source code is available under the GNU General Public License.
Learn more…10,264 questions
Sort by count of
-
199
votes9
answers12451
viewsHow to prevent SQL code injection into my PHP code?
I developed a PHP page for internal use of the company I work with and only very few people use it. Through this page it is possible to make some queries, insertions, changes and removals of data…
-
14
votes8
answers26648
viewsHow to backup Mysql Database Diaries?
Is there any free tool, or even a script (.bat) that I can use to make a backup automatic from my database? I wish that backup was generated by saving a single file .sql.…
-
36
votes8
answers7830
viewsIs giving a "SELECT" before an "INSERT" a safe way of not having duplicate records?
I have a table with a column codigo. I cannot set as primary key. In a system it receives many notifications before it checks with a SELECT to see if that code already exists in the table. If it…
-
60
votes7
answers8794
viewsHow to Convert Mysql Database?
In the development of a web portal, using the git we made the control of everything that was changed at code level in the approval environment and with the Jenkins We moved the site to the…
-
9
votes7
answers31206
viewsHow to insert data into DB with jQuery/Javascript without using PHP?
I am learning Javascript and jQuery and I am wanting to make a small site to test the insertion of data in a database. I have no knowledge in PHP, I wonder if it is possible to insert data in a…
-
9
votes7
answers30383
viewsHow to dump a Mysql database with PHP?
Currently, to export only the structure of a given database, I use the following: mysqldump -h host -u usuario --no-data --database banco > dump.sql -psenha This generates an SQL file, all…
-
3
votes7
answers3667
viewsPDO does not connect to Mysql
I’m trying to make a connection to the bank by PDO, but every time I try to make this connection, the message appears: could not find driver I went back to find out and learned that I had to enable…
-
8
votes7
answers54187
viewsRemove letters and special characters in a select
I have in my table the field documento with the following data: How do I select only the numbers of these records by removing the letters and special characters? DOCUMENT CPF-12345698-35…
-
29
votes7
answers68940
viewsHow to make SELECT with ORDER BY and different criteria?
People can select with 2 "ORDER BY"? Table CATEGORY: If I make a SELECT like this: select id,nome from CATEGORIA ORDER BY nome ASC Mysql returns the names in alphabetical order, but I need it to…
mysqlasked 8 years, 10 months ago Hugo Borges 5,294 -
247
votes6
answers12507
viewsWhy shouldn’t we use mysql_* functions?
A very common question is why should we stop using mysql_* functions? For example mysql_query(), or mysql_connect(). I see that many people use them, or stop using them but do not know the real…
-
8
votes6
answers52587
viewsHow do I use a database on an HTML site?
I am interested in making a site that will use a database, many told me they use Mysql to do this, but I have no knowledge about it, installation, use etc. I have knowledge in PHP, HTML, CSS and…
-
8
votes6
answers1639
viewsRemove an undetermined number of " " in a column in the database
The field description on the table product contains HTML generated by Ckeditor (English) that tries to escape the content: <table…
-
7
votes6
answers5683
viewsCopy Wordpress database without using Phpmyadmin
I need to migrate a Wordpress site from one server to another. One of the necessary steps is to export the database used on the current site, edit some data if necessary (such as the site address…
-
15
votes6
answers11947
viewsHow to create a password reset link?
I am developing a site that has user registration area, the password is encrypted to increase security on the site, but when the user forget the password how will it be possible to return his…
-
14
votes6
answers14419
viewsWhich database should I use in a small desktop application?
I read a bit about the Meta and I thought that this question does not escape much from the current rules of the site. Risking losing reputation, come on: At the moment I work in a small company that…
-
14
votes6
answers11304
viewsHow to get distance given the coordinates using SQL?
I’m doing a function in php, in which, given a GPS coordinate, it will search in the database the recorded locations, which are not necessarily fixed, within a certain distance. My question is, how…
-
4
votes6
answers1555
viewsHow to do the following query without using INNER JOIN?
I have table A with the following fields: ID | ID_PAIS_ENVIO | ID_PAIS_RECIBO 1 | 23 | 47 //... I have table B with the following fields: ID | NOME_PAIS 23 | Brasil 47 | Portugal //... I need a…
-
11
votes6
answers57963
viewsHow to convert UTF-8 characters in PHP
In my web application, I am using a Mysql database that has the table EditableContent. This table has the field content, who’s kind text and has as input format utf8-bin. In the database the…
-
13
votes6
answers4694
viewsHow to make a stopwatch continue counting after closing the page?
I need to create a stopwatch that is started through a play, but wanted a solution, other than by SESSION, to let you count even if the customer closes the window or drops his internet, ie that is…
-
3
votes6
answers12215
viewsHow to view php/mysql and Angularjs data?
I’m trying to do some tests with PHP + Mysql + Angularjs and I was stuck in a doubt of how to treat the database data with angular and send to screen, I have the following codes: con-bd.php <?php…
-
10
votes6
answers992
viewsLike saving today at the bank?
How do I automatically save the day in the database without having to pass it when adding the product or whenever you add a product it automatically already writes the date of the computer in a…
-
2
votes6
answers2011
viewsHibernate is not creating the tables
I am new to the subject Hibernate, for the little I have learned, I believe I did everything right, ie, I lowered the dependencies, I wrote down the classes, etc. Below follows my class example:…
-
0
votes6
answers393
viewsIf it doesn’t work
I’m developing a website, in it some users will access and need to the password expires every 30 days. I did that check, but never falls into it, even when the if is true. If anyone has any idea…
-
33
votes5
answers74978
viewsHow to get the table name and attributes of a Mysql database?
How to get the names of all tables in the database Mysql? How to get the attributes (name, type, etc...) of a given table in the Mysql database?
-
40
votes5
answers10782
viewsWhat is a Mysql Transaction for?
I was studying some examples of Mysql with PHP and came across as following code snippet: try { $db->beginTransaction(); $db->query('query 1'); $db->query('query 2'); $db->query('query…
-
10
votes5
answers98198
viewsHow to display the result of a query on an PHP html page?
How can I display the results of a query in a table of an html page? Below is what I was able to do. However, the code only shows the first record. include("conectar.php"); $sql =…
-
12
votes5
answers21638
viewsCurrency formatting to save to database as DECIMAL
I am using a mysql database, the format of the field is Decimal (7,2) and he gets his salary. Based on what the user types I store in the bank so: str_replace(',','.', $_POST['txtSalario']) Replace…
-
4
votes5
answers620
viewsHow to select records that have a relationship with all values in a list?
I have the following sql: SELECT DISTINCT cp_pessoa.id, cp_pessoa.nome FROM cp_pessoa LEFT JOIN cp_habilidade_freelancer ON (cp_habilidade_freelancer.id_freelancer = cp_pessoa.id) LEFT JOIN…
-
2
votes5
answers7780
viewsHow to use str_replace in single quotes without removing the ones that are required?
I’m going through a database of a friend who had some data entered wrong or a little confused or I’m the one who’s making it difficult. Ex: Mariana "Gurizinha’s" This example was saved in the bank…
-
45
votes5
answers41645
viewsWhat are the advantages and disadvantages between Mysql and Postgresql?
I have been with this doubt for a long time, I see some people recommending the use of Postgresql, but it is not clear the advantages and disadvantages compared to Mysql. I want to define the bank…
-
2
votes5
answers491
viewsProduct search by name and brand
I have two tables, one call brands with product brands and another call products. Within that table products has shirts, pants and etc. I want that when making a search, for example "Hollister…
-
-1
votes5
answers1314
viewsPHP connection problem with Mysql
All the settings are right I don’t know why not connecting.. locally works, but when I step to the server gives this problem. $hostnome = '192.185.176.204'; $usernome = 'tookc892'; $senha = '***'…
-
6
votes5
answers29249
viewsHow to calculate age based on DATE of birth in Mysql based on month and day?
I have the appointment below, but she ignores the month and day of birth SELECT FLOOR(DATEDIFF(NOW(), c.nascimento) / 365) AS idade FROM clientes c In the result, most come right, but sometimes have…
-
32
votes5
answers41630
viewsMysql Limit Equivalent in SQL Server
Someone knows how to relate the differences between Mysql and SQL Server, including using LIMIT n,n? Or if you have a link that lists the differences would be nice. Example SELECT * FROM tabela…
-
3
votes5
answers4257
viewsRow size Too large (> 8126)
Gave me an error while loading mysql data. Row size Too large (> 8126). Changing some Columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In Current Row format,…
-
5
votes5
answers6853
viewsConvert Date field data to Mysql month
In a comic book table I have a 'Data' field (0000-00-00) and I need to do the following: Create a field next to 'Month' that takes the date Ex: 2014-08-27 and pass the value 'August' to the month…
-
4
votes5
answers6102
viewsHow to create a view in mysql by taking data from 3 tables and repeating the different columns in the result?
I have the tables: +----------Tabela-1--------+ id | nome | cnpj | qtd1 1 | carlos | 0563233 | 4 +--------------------------+ +----------Tabela-2--------+ id | nome | cnpj | qtd2 1 | carlos |…
-
4
votes5
answers57768
viewsCount equal records with SELECT DISTINCT and COUNT
How do I count the equal results and add the amount in front? For example: Currently the records of my table are like this: Id | Nome ------------ 0 | Teste 1 | Teste 2 | Teste I want to give a…
-
13
votes5
answers53548
viewsMysql decimal value
I am trying to insert decimal value in mysql database, wanted to put these values for example: 1.500,00 Thousand, hundred and ten What is the type of column I must declare?…
-
9
votes5
answers6499
viewsSave the binary content of an image in the database
How do I get the bytecode of an image at upload time to be able to store it in the mysql blob field without the need to save the image to ftp?
-
5
votes5
answers45344
viewsAccess website on local network through my Android phone
I made a site in PHP and Mysql responsive and would like to access it on my Android phone by localhost, I know I have to put my IP on browser but when I send access it appears the following error:…
-
0
votes5
answers2474
viewsHow to select a checkbox and recover data in the database?
I have two types of checkbox and I need that when selecting one of the two is displayed a field of type input text with the information coming from the database. The field input will be disabled,…
-
4
votes5
answers26088
viewsRegistration problem (Column Count doesn’t match value Count at Row 1)
I am having the error "Column Count doesn’t match value Count at Row 1" when I try to register. I already checked my comic book and everything seems to be in order but nothing to solve this mistake.…
-
10
votes5
answers11633
viewsHow to do a LIKE ignoring accentuation?
I need to make queries in a database of registered users. However, I need this survey to be done by the name of the user, through the LIKE, and this should ignore the encoding UTF-8 present in the…
-
9
votes5
answers38375
viewsConvert date to dd/mm/yyyy format
I’m getting two PHP post of two dates in format dd/mm/yyyy, however to display the data need to convert dd/mm/yyyy for yyyy-mm-dd. Code: if (isset($_POST)) // Se existir o array post, pq ele não…
-
0
votes5
answers3030
viewsCodeigniter -> Message: Trying to get Property of non-object
I’m trying to fix this bug: Severity: Notice Message: Trying to get Property of non-object Filename: contracts/view.php Line Number: 37 CODE: contratos_model.php public function getById($id){…
-
1
votes5
answers580
viewsDoubt in SQL query "between" or "in"
I am generating a report between date, as the figure below: However, when I enter the starting date: Initial year: 2014 Initial month: 6 and Final year: 2015 Final month: 5 does not bring the data,…
-
10
votes5
answers26385
viewsWhat is the best practice to know if an Row exists in a SELECT in Mysql?
For example, when we check if a user is already registered in the table, we do not need any data return by query, just check if the number of Rows is greater than 0 (num_rows > 0). Us scripts and…
-
5
votes5
answers839
viewsHow can I add a value to a Row in the comic without having to add variables?
Well, here’s my question: I have the balance of a certain user Row from my database table that has 100€, and I wanted to add +50€, as I can do without having to create a variable with his current…
-
7
votes5
answers2439
viewsSubtract sums of fields in two separate tables
I need to add the value of a column in SQL, so it looks like this: SELECT SUM(qtdsaco) FROM armazem This code works. Now I need to add the value of the other table, here it is: SELECT SUM(qtdsaco)…