Most voted "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
-
4
votes2
answers655
viewsProblem Migrating Mysql Database to SQL Server
I am unable to migrate a database from Mysql to SQL Server using Mysql Workbench Database Migration. In SQL Server authentication, it uses sa login, I tried to reset the password of this login, but…
-
4
votes2
answers174
viewsThe less consultation the better, right?
It is possible to vary the writing of the results, as an example below where I want to use. <table width="1000" align="center"> <tr> <td> NOTICIAS</td>…
-
4
votes2
answers6065
viewsCounting lines reached PDO
I’m doing a query and need to count the number of returned lines, I’m not usually used to doing this in PDO, follow my code below. $sqlCODCEL = $conn->prepare("SELECT * FROM tbl_CELULAS WHERE…
-
4
votes1
answer854
viewsmysql + PHP - use or not use mysqli_close()
I just noticed I’m not using the function mysqli_close() indicated on the website of PHP.NET I monitor the connections through Workbench client conections and there are open connections, my doubt is…
-
4
votes2
answers961
viewsCalculate maturity date
I have a column called START in DATETIME format in Mysql and I would like to check if each Row is expired and/or how many days are left to win that Row, taking into account that Row expires 30 days…
-
4
votes2
answers2045
viewsPHP accent problem, Mysql
I have a very strange problem with my PHP code. All my charset are correct <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta charset="utf-8"> I already use the…
-
4
votes1
answer135
viewserror in mysql_result()
I am again looking for help to understand an error given in a call to mysql_result(), which I cannot solve this error: Warning: mysql_result() expects Parameter 1 to be Resource, Object Given in C:…
-
4
votes2
answers1348
viewsUpdate involving 3 tables
I have 3 tables: TABELA A ID ID_TABELA_B 1 188 2 189 3 190 4 200 TABELA B ID ID_TABELA_C 188 22 189 22 190 22 200 23 TABELA C ID NAME 22 Gato 23 Cão Table A is linked to table B and table B linked…
mysqlasked 9 years, 7 months ago Filipe Moraes 8,737 -
4
votes1
answer270
viewsCardinality in class diagram
When I diagram classes or MER, the cardinality should be defined. As an example: A doctor consults from 0 to n patients; a patient is consulted by 0 or 1 doctor. Why the 0?
-
4
votes2
answers4412
viewsINSERT in two different tables - Mysql
I have two tables in Mysql: Alunos: id, nome, idade, email, senha. login: id, email, senha. When I do Insert to record the information in the table alunos I can do another insert to save the email…
-
4
votes1
answer1630
viewsMonetary values with Asp.net MVC
I am facing difficulty in working with monetary values (decimals) using web application, asp.net MVC, with database Mysql. The problem is I can’t edit decimal values, like: 53.50, or 53.50. I can’t…
-
4
votes1
answer354
viewsChange a Select mysql to a Select PDO
I have a select of sources registered in a table, and I currently use this code to list them so that the user can choose the desired source. <select name="tipo_font_end"> <?php $select =…
-
4
votes1
answer1574
viewsHow to make a query with Node.js and Mysql
Hello, I’m starting with Node.js and MySQL, and I have some problems at the moment. Well, I have a table called users, and I need to request data for verification, for example: My site has a…
-
4
votes1
answer181
viewsHow to avoid duplication of content in a table without a primary key?
In a virtual shop panel I am building the products have relations by color and size, where each product color has a size. This is a part of my database to better understand the problem:…
-
4
votes2
answers861
viewsHow to generate code before entering data into the database
I need to generate a code that matches id which will be auto-incremented in the database. It will be a routine that checks the last id generated and generates a code that will be the id later before…
-
4
votes1
answer1552
viewsCreate database via existing command line and overwrite
I have a Function (Delphi) that creates processes and executes BAT files that make, for example, backup a Mysql BD, like this: "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqldump.exe" -u root…
-
4
votes2
answers4187
viewsError while deleting FK
I have a table called: soliciting codemprestimo, dataemprestimo, horaemprestimo And another table called: loan, co-loan, loan, loan, loan, loan, loan) and used this command: INSERT INTO emprestados…
mysqlasked 9 years, 5 months ago Carlos Leandro Ferreira de Alm 339 -
4
votes1
answer1222
viewsField Primary key from int to bigint
Well I need to turn my primarykay fields from int to bigint, but it is giving a problem. Follow the code below: Executing SQL script in server ERROR: Error 1025: Error on rename of…
-
4
votes2
answers369
viewsHow to add everything in MYSQL
How do I sum everything from a table in Mysql for example.. I have the table tb_comment, then I want to add in each post(id_mark) the amount of rate it will have in total. For example the id_user 20…
-
4
votes1
answer281
viewsOptimize search in Mysql
Hello I have a query that I can’t optimize. Records: 1.904.447 records Name: table_mae Related to Records: 10.748.360 records Name: table_son -- index criado para id_tabela_mae -- index criado para…
-
4
votes1
answer3720
viewsClear screen prompt Mysql
Does anyone know how to clean the prompt screen MySQL? After a certain time the screen gets full and I want to clean up. I do this at Windows prompt, but Mysql could not. I’ve tried to: \! cls, CLS,…
-
4
votes3
answers252
viewsUse of preg_replace invalidates password with SHA1
Was using preg_replace, to avoid SQL Injection: $senha = preg_replace('/[^[:alpha:]_]/', '',$_POST['senha']); When comparing the $senha received by POST with the bank password (using SHA1) they are…
-
4
votes2
answers1031
viewsWhat’s the difference between bindValue and an array executed directly in $Pdo->execute()
Currently I use a schedule like this <?php $array = array('nome'=>'Alisson', 'idade'=>20); $query = $conn->prepare("INSERT INTO table (nome,idade) VALUES (:nome, :idade)");…
-
4
votes1
answer783
viewsTwo conditions in SQL query with Laravel 4
I need to make a query to Mysql with two conditions. I tried to do so: $query=DB::table('veteranos')->where('ra', '2300')->where('flag', 0)->pluck('ra'); In this way, the second condition…
-
4
votes3
answers107
viewsDoubt with relation of tables
Good evening I have the following BD in Mysql CREATE TABLE IF NOT EXISTS `cad_cliente` ( `id_cliente` smallint(5) unsigned NOT NULL, `nome_cliente` varchar(45) NOT NULL, `nome_dr` varchar(45) NOT…
-
4
votes1
answer494
viewsAdd data from a column
id .. product...value...id_sale...total value 01 .. Pen.... 2,00.... 1....... 30,00 02 .. Rubber. 4,00.... 2........... 25,50 03 .. .Lapis...... 5,00.... 1........ 10,00 04 .. Pointer…
-
4
votes3
answers153
viewsDatabase with php
I am trying to perform a database query with the following script: <?php require("conexao.php"); $exibir = mysql_query("SELECT * FROM produtos"); while ($r = mysql_fetch_array($exibir)){ $id =…
-
4
votes1
answer1916
viewsTest connection to the database
I have an application that has a central database, in it is carried out the registration of several databases dynamically to use in another part of the application. I want to know how to test if…
-
4
votes1
answer1369
viewsPDF Data Import in PHP
It may be a stupid question, but I still have to ask: You can import data from a file in pdf in the php and save in bank mysql?
-
4
votes2
answers703
viewsHow to save multiple users to an account like Netflix for example
Next, I have an application that supports only 1 account per user, I want to update the database on MySQL so that it supports a system that can be saved for example, child accounts, derived from…
-
4
votes1
answer657
viewsRandomized and ascending order query in MYSQL
I have a table where I have the student’s name and his score, I need to pick up 5 random students and display them in ascending order of the score. I tried to do it this way, but he’s just randomly…
-
4
votes1
answer85
viewsEfficient execution of PHP PDO queries
Is there any performance difference in the codes below? $result = $pdo->query($sql); foreach($result as $reg){ ... } and... foreach($pdo->query($sql) as $reg){ ... } I’ve run some tests, but…
-
4
votes2
answers22129
viewsGet current date in mysql
Colleagues. I have a table that stores the registration dates with DATETIME(), but I need to check if the registration date is equal to the current date, so I did it as below, but it doesn’t work:…
-
4
votes3
answers210
viewsFunction contrary to TRIM
How to insert characters in a field varchar in Mysql? For example, in the update with Trim vc you can remove certain characters from a field varchar... but and add ? Example: update tabela set campo…
-
4
votes1
answer249
viewsSplit and search messages by older and newer
I have a table. In her the 4 columns ID high-increment, id_user1 would be the id of the user who sent the message, id_user2 either would be the id of the user who received and mensagem the one who…
-
4
votes1
answer3424
viewsHow to rank with PHP
Well, I have a problem, I know how to pull the ranking and all. My question is I’m gonna pull the 6 with the highest score, and I wanted the first 3 to have a different background, like: Whatever…
-
4
votes2
answers665
viewsSum date with int
I’m trying to make a sum of days, informed in a field int,with a field date using SQL. I tested it as follows, but it sums up the day, but ignores month and year. Is there any way to make that sum?…
-
4
votes2
answers646
viewsAutomatic PHP function
I need every day, the system sends shipping orders to the post office. How can I do this automatically, without needing any user to load the page or anything like that? I would use the same logic of…
-
4
votes2
answers1837
viewsGroup column sum by quarter
I would like to group the sum of one column per quarter, that is every three months. I have the following query which groups from month to month: select month(data) as mes, year(data) as ano,…
-
4
votes4
answers8025
viewsSearching dates through BETWEEN AND
I have the following situation, where when trying to query a date by another date using BETWEEN, the specified deadline does not return, only "the previous day". Is there an outline to address this…
-
4
votes1
answer404
viewsCount in Ireport
I have a report where I have the column Status, in this column I have the following status: Finalized and Pending. I created a variable and added it to the band Sumary and configured the following…
-
4
votes1
answer54
viewsFunction for file upload
I’m trying to create a function that takes 1 value from a input do tipo texto and 1 file. I was able to move the file to the folder but I’m not able to develop SQL to insert the file name in the…
-
4
votes3
answers785
viewsHow can I make a query with LIKE or REGEXP ignoring table words?
I have the following data in a table ------------------- **usuarios** ------------------- nome ------------------ Wallace de Souza Vizerra ------------------------ Gustavo Carmo da Costa I need to…
mysqlasked 9 years, 3 months ago Wallace Maxters 102,340 -
4
votes3
answers195
viewsCan you do a + or - value operation in a Mysql query?
Example: select quantidade from tabela where quantidade é mais ou menos = '5'; Does anyone know any way to do this in Mysql? I have an approximate value of 5 and I would like to bring it from the…
mysqlasked 8 years, 6 months ago eduardo belini 79 -
4
votes1
answer139
viewsfrom sql server to mysql with php
I have a bank SqlServer and I need to send data from a table to a Mysql database via php script. OPENQUERY will result within the condition I have (php script)? What’s the best way to do it? The…
-
4
votes2
answers114
viewsInsert Mysql PDO
Well, I need to do an insert and I use PHP OO, but how do I do this? According to my code is registering, but is not working perfect. I’m doing something wrong ? Do not give any error message, just…
-
4
votes2
answers217
viewsInclude a digit before the phone in the BD register
I have a system where was registered 18 thousand users, but I realized that the mobile phones and fixed are missing a digit. Ex.: (21)9999-999 or (21)2222-222. Although the field is CHAR(14). Is it…
-
4
votes1
answer169
viewshow to use foreach
Hi, I’m here to enlist the help of friends. I have this code below to list all products and be registered, but I’m not able to list them on the same page using foreach. Could your friends give me a…
-
4
votes3
answers607
viewscheck query in 2 tables at the same time with mysql
I have two tables in my BD (mysql), where: 1st Table: CADASTROS With the following fields: ID, NOME, IDADE, CIDADE 2nd Table: FUNCIONARIO With the following fields: ID, ID_CADASTRO, PROFISSAO,…
-
4
votes1
answer1055
viewsHow to show the bank’s value in a star rating?
I was able to do the star rating system, but I wanted the vote to be shown on the screen or stored on the star, so it would be filled according to the votes. Someone could help me, here’s my code:…