Questions tagged as 'mysql'

1
answer

How do I get the next ID to be inserted?

I would like to get the next ID to be inserted, something like: $ultimoid = (DB::lastInsertId()); $futuroid = ( $ultimoid + 1 ); The purpose is to know beforehand the ID that will be used in my INSERT because before even inserting the recor...
asked by 01.01.2015 / 20:45
4
answers

How to do advanced data filtering across multiple fields? [closed]

I have a table from which I need to get results varying by certain user data: I need to return the rows where each column or hit with its user parameter or is blank (null). Consider as user parameters the bottom of the image - USER_ID =...
asked by 08.01.2015 / 20:04
2
answers

SQL Select return only one of several

I have two tables. "User" table that has 5 rows and 5 users. andthe"lease" table that has 20 records, using 5 foreign key ID of the user table WhenIusethisselectIdidselectu.nomefromusuarioujoinlocacaolonl.UsuarioId=u.idItreturnsmethef...
asked by 11.10.2018 / 10:02
3
answers

Help with SQL query with COUNT in multiple lines

Hello, I'm doing the following query SELECT p.id, c.nome, v.titulo, count(v.titulo) FROM passageiros AS p LEFT JOIN clientes AS c ON c.id = p.id_cliente LEFT JOIN viagens AS v ON v.id = p.id_viagem GROUP BY v.titulo; And it is returning...
asked by 09.12.2018 / 04:37
1
answer

Save Mysql php data to a single table

I'm having a small question on how to save a form in mysql that is. I have a form that is divided into 2 and I want it to be saved in the same table. When I save I only save the second part of mysql it deletes the first one to me. Example...
asked by 12.06.2014 / 17:43
2
answers

Doubts Date with PHP and JS

I do not know anything about JS and would like to know if I have edit a field whose value came from the database using javascript? Because I saved the date of birth and the phone number of a client on the bank, and at the time of registration I...
asked by 03.03.2016 / 06:30
2
answers

___ ___ erkimt Get database data ______ qstntxt ___

Well it's the following I have the following code:

%pre%

Supposedly, I want to get the login data, where login is equal to $ login variable, and then display the login password, however the following errors appear:

  

Warning: mysqli_query () expects at least 2 parameters, 1 given in   C: \ Program Files \ VertrigoServ \ www \ adm \ logar.php on line 9

     

Warning: mysql_fetch_array () expects parameter 1 to be resource, null   given in C: \ Program Files \ VertrigoServ \ www \ adm \ logar.php on line 10

What's wrong?

Thank you.

    
______ azszpr115525 ___

The %code% function in procedural mode waits for a parameter variable to create a connection with the bank and the one with the query itself, you are just passing the query.

Try this:

%pre%

However, the query would be very vulnerable in this way, you could parameterize this query, like this:

%pre%

This narrows the vulnerability a bit, but does not mean that the code is safe with just that.

    
______ azszpr115524 ___

It is necessary to pass the connection parameters when using the mysqli_query functions, and as the comrade said, try not to mix the two libraries.

More about mysqli: link

    
___

Well it's the following I have the following code: <?php $verifica = mysqli_query("SELECT * from dados WHERE login='$login'"); $array = mysql_fetch_array($verifica); $array[senha]; ?> Supposedly, I want to get the l...
asked by 27.02.2016 / 01:13
3
answers

Help with SubQuery in SQL?

I have in my system a table called Agendas, this table is linked to other Class and School tables through columns turmas_id and escola_id . What happens is that the turmas_id column is not a related foreign key even if it rec...
asked by 01.03.2016 / 13:41
2
answers

Unknown column error in MySQL query

Code: (SELECT TB_INGREDIENTES.ID_INGREDIENTE, TB_INGREDIENTES.INGREDIENTE, TB_INGREDIENTES.QUANTIDADE_INGREDIENTE_TOTAL, TB_INGREDIENTES.FLAG, TB_INGREDIENTES.ACRESCIMO, TB_PRODUTOS_INGREDIENTES.ID_PRODUTOS_INGREDIENTES,...
asked by 12.09.2014 / 14:04
1
answer

What are the differences between sql commands?

What's the difference, when should I use the following sql commands and which expressions can accompany these commands? order by ,group by, join e union What is the use and when should I use the commands below in a select? 1) where nomeda...
asked by 30.09.2014 / 12:02