Questions tagged as 'mysql'

3
answers

Foreign Key in another database?

Doubt in MySQL ... What are the possible problems that can occur when doing a foreign key in different databases? Considering this type of foreign key and a View that looks for information from another database, which one is most useful?...
asked by 31.07.2014 / 19:26
2
answers

mysql organizing entries in the database

I wanted to know if it is possible to reorder the table entries in mysql, overwriting the deleted entries, and without breaking the other tables. If it is possible, which command would you use and give me some examples. For example: In table...
asked by 01.08.2014 / 04:23
2
answers

BD sales register

Good morning. I'm doing a sales web app, and I want to return the sales ID to insert into the intermediate product_product table (multiple products in 1 sale). I tried it that way, but obviously I could not: <?php $connect = mysqli_conn...
asked by 21.12.2018 / 15:00
1
answer

How to separate the HTML from the Java code of connection to the bank?

I have a database and an html code that finally managed to make a connection but the code is a bit messy because it mixes html with java and mysql ... Here's an example: <%@page import="java.io.*,java.sql.*" %> <% Class.forNa...
asked by 22.12.2018 / 19:09
3
answers

Select Group by Month

SELECT dataVen, Sum(valorTotal) as valorTotal FROM cad_cr2 Group by MONTH(dataVen) The above query returns the following values:    Iwishitwerethatway,groupedbymonth:   I've done a lot of research and try, but without success.     
asked by 28.12.2018 / 19:57
1
answer

Java and MySQL - Error - Timezone

I try to connect to MySQL with the code below. I do not use Hibernate, or anything. It's just to connect to the bank and run a simple SQL clause. I get the error below. I've seen some questions with answers here, but I confess I did not under...
asked by 28.12.2018 / 19:48
2
answers

Querying data in PHP using the $ .get json method and listing data in an html

I can do the data insertion but I have no idea how to do data selection on a HTML using $.get JSON . php code public function Inserir($tabela,$sql){ ksort($sql); $Campos_nome= implode('', '', arr...
asked by 28.05.2014 / 11:25
1
answer

Mysql order by field date original value

I'm doing a query and I'm transforming the data no formato brazilian and then I want to use the data_vencimento original in order by but it does not work code: SELECT *,DATE_FORMAT(data_vencimento,'%d/%m/%Y') as data_ve...
asked by 26.05.2014 / 17:40
1
answer

Filter year and month PHP and MySql

function filtrarData($datap) { $sql = "SELECT * FROM despesas WHERE YEAR(data_pago) = ? MONTH(data_pago) = ?"; try { $com = $this->db->prepare($sql); $com->bindValue(1, $datap->getDataPago()); $com->bin...
asked by 31.10.2018 / 14:19
1
answer

Prohibit user to register 2 users with emails and matriculas equal [duplicate]

I wanted when the user was to register, if he informs an email or registration already existent in the bank of that a message and it is forbidden to register in the system, in the code below it continues registering the user even with the ema...
asked by 01.11.2018 / 19:11