Questions tagged as 'mysql'

1
answer

Is it possible to give insert with select?

I have two tables: hardware(ID, DEVICEID, NAME, ...) and softwares(ID, HARDWARE_ID, PUBLISHER, NAME, VERSION, ETC ...). I need to insert into the softwares table, but I do not have HARDWARE_ID , I only get the hardware name (...
asked by 22.11.2016 / 15:11
2
answers

How to resolve this 'java.lang.IllegalArgumentException: Unknown entity' when running this simple application?

I'm new to the Hibernate world and when I run this application, I get the following exception: java.lang.IllegalArgumentException: Unknown entity: com.nataniel.api.domain.User at org.hibernate.ejb.AbstractEntityManagerImpl.persist(Abstrac...
asked by 27.11.2016 / 02:42
2
answers

How to generate code before entering data in the database

I need to generate a code that is equal to 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 id later before inserting the data. Fo...
asked by 19.11.2015 / 21:40
3
answers

Database with php

I am trying to query the database with the following script: <?php require("conexao.php"); $exibir = mysql_query("SELECT * FROM produtos"); while ($r = mysql_fetch_array($exibir)){ $id = $r['id'];...
asked by 06.01.2016 / 17:06
2
answers

Query in MySQL to return scheduled records for the next 30 days

I have a table called AGENDA, where I have the fields, ID, Location, Date. Doing the insertion and selection within the database I've already been able to do correctly. But I can not select the date in ascending order, showing the events that wi...
asked by 03.05.2014 / 04:22
3
answers

Cut string on the last occurrence of a character in a string

I have text in a column that has information separated by "-" (hyphen) and I need to remove the last and last but one information. Examples: Transform " Informacoes - Separadas - Por - Hifen " into " Informacoes - Separadas ";...
asked by 30.05.2016 / 22:42
3
answers

Count the columns of a MySQL table using PHP

How can I count the columns of a MySQL table using PHP, does anyone know of any commands to do this? I tried to do this but it did not work: $sql4 = mysql_query("show fields from ".$tabela) or die('erro na query'); $rows4=mysql_fetch_array(...
asked by 26.06.2014 / 14:11
2
answers

How to make a NOT IN mysql with 2 tables

I have 3 Person tables, group_materia, Notes, table person has: +------+--------------+-----------+ | id | Nome | turma | +------+--------------+-----------+ | 1 | Aluno 01 | 1 | | 2 | Aluno 02 | 2 |...
asked by 05.05.2018 / 15:14
1
answer

System hashtags in PHP

I'm developing a hashtags system in PHP , and my question is: How can I make a% of% of posts from content? For example, the content saved in the database is:    Hi, how are you? #bomdia In case the SELECT would be somet...
asked by 28.05.2015 / 01:52
2
answers

How not to automatically sort IN (MySQL)

I run this SQL command: SELECT * FROM produtos WHERE id IN (144,140,134,133,128,129,141,143,149,150,147,146,126,142,125,99,100,92,91,90,108,109,123,124,122,121,110,89) ORDER BY none But the query comes with the IDs sorted, how to prevent...
asked by 01.06.2015 / 22:33