Questions tagged as 'mysql'

1
answer

Left Join repeat tables

I'm trying to mount a select that has the result below: With the select below I can see null in only one column. How could I make it work for 20? I have item_1 through item_20 and the item description is in the parts table, in the occ...
asked by 07.03.2016 / 19:05
1
answer

How to do a "while" of the number of rows in a query?

Does anyone know if in that PHP function - mysql_num_rows do I have to while in it? I need to break the total number of rows in the table. I tried to do: $sql = "select ..."; $query = mysql_qery($sql); $rows = mysql_num_rows($que...
asked by 04.03.2016 / 12:17
1
answer

Error declaring variable in login system

I'm doing a login system and now I come across a "Notice" that indicates that my Variable is not set. This variable is not entered by the form. It is defined by a function that will generate a key. KeyGenerator() ; I checked several ti...
asked by 27.02.2016 / 13:51
1
answer

How to fix the "1452 foreign key constraint fails" error using PDO in PHP?

Firstly I know what the foreign key error is, however I do not know why it is happening in PHP code with the PDO.    Insertion Function: function insert_pedido($cod,$pagamento,$total){ (int)$id = $cod; $con = $this->connect(...
asked by 02.03.2016 / 19:51
1
answer

How to check if something was passed to the php page?

It's even hard to ask because I do not know if it's okay, but I'll try to explain it as best I can. I have a page where I will use the php switch case to decide the action according to what is passed. However, if the page is only triggered witho...
asked by 14.02.2016 / 01:42
1
answer

ERROR 1241 (21000): Operand should contain 1 column (s)

I have this select SELECT 'works'.'grade_id' FROM 'works' INNER JOIN 'work_images' ON 'work_images'.'work_id' = 'works'.'id' INNER JOIN 'work_students' ON 'work_students'.'work_id' = 'works'.'id' RIGHT OUTER JOIN qrcodes on qrcodes...
asked by 04.05.2016 / 00:23
3
answers

SQL - Query on a single table with null values

Hello, I need to do a filtered query by date. The problem is that dates that do not exist in the table need to be returned by the query, having all other fields as Nulls. SELECT Data, Servico FROM controle_equipe WHERE ((Data >= #4/1/201...
asked by 03.05.2016 / 01:59
1
answer

Multiple ADD INDEX together or separate?

I wanted to know the practical difference between this, in MySQL : ALTER TABLE 'tabela' ADD INDEX 'col1' ('col1'); ALTER TABLE 'tabela' ADD INDEX 'col2' ('col2'); For this: ALTER TABLE 'tabela' ADD INDEX 'col1col2' ('col1', 'col2'); S...
asked by 10.01.2016 / 20:30
1
answer

how to make an inner join getting the description

My tables: agencias (id, nome_agencia, ads -> FK pra tabela de baixo) ads (id, nome, agencia -> essa é FK pra tabela anterior) The problem is this: each agency will have ads no ads have a lead agency I want to make a select display...
asked by 14.12.2015 / 16:08
1
answer

Create Task MySql database

I need to create a JOB (known in sqlserver) in a mysql database, first, I would like to know if there is such a possibility, and if so, what would syntax look like? I have a table that saves a date column, I want the database to execute a tas...
asked by 16.12.2015 / 18:16