Questions tagged as 'mysql'

3
answers

How to connect to MySQL only once, without ever having to instantiate?

How do I connect to MySQL only once, without having to re-write it in every function? Currently I do this: class Site { var $driver; var $host; var $dbname; var $user; var $pass; public function __construct($driver,...
asked by 08.12.2014 / 14:51
4
answers

Permission error when trying to access database [closed]

   Error: SQLSTATE [28000] [1045] Access denied for user 'root' @ 'localhost'   (using password: YES)     
asked by 06.02.2014 / 21:19
1
answer

Can I change more than one record at a time?

This is the code: UPDATE PESSOAS SET COR = ('Pardo') WHERE ID = 1; But I have 2 more records to do the same procedure, would you do it all at once by adding ID ?     
asked by 27.10.2017 / 19:55
2
answers

Search returns equal data

I'm doing a search system where you have some fields (conditions) to search and find the results. These fields are not mandatory, in case the person type something he will find the data entered, in case the person does not type, the system will...
asked by 15.09.2014 / 11:56
1
answer

Fill in a collection type property

Good evening folks how to populate a collection type property using this type of structure in a class: public class Order { public string orderNumber {get; set; } public DateTime orderDate {get; set; } private D...
asked by 20.06.2015 / 03:46
2
answers

Failed to connect to MySQL via VBA

I'm trying to connect to a Mysql database via Excel VBA, but it returns an error reporting catastrophic failure. I did a test by entering the wrong password, or the wrong database name, and it informs that access was denied or the database does...
asked by 12.12.2014 / 12:50
1
answer

How to mount a SELECT to return the last status change of each id?

I have the following table: status_faturas id_fatura | status | data ---------------------------------------- XX-XX-XX | 3 | 2017-01-04 21:00:24 XX-XX-XX | 2 | 2017-01-02 11:10:20 YY-YY-YY | 4 | 2017-01-04 21:00:24 YY-YY-Y...
asked by 05.01.2017 / 00:08
1
answer

Why should we use "IS NOT NULL" instead of "NULL"?

I always asked myself this: Why should we use IS NOT NULL instead of <> NULL ? For when I do as in the second case, no result is found. Example: SELECT * FROM tabela WHERE campo IS NOT NULL Displays all rows, except wh...
asked by 18.08.2015 / 22:24
3
answers

Is there any way to display the string size in a MYSQL result?

Is there any way to display the string size in a MYSQL result? I need to, for example, know the size of a given string returned in a SELECT with group_concat . What I want would be something like this example: SELECT "nome",...
asked by 28.08.2015 / 18:53
4
answers

Array of SQL conditions - PHP

Good afternoon, I am sending a search filter for my DB, and I want to make these conditions within an array, for example: $condicoes = array(); $nome = $_GET['nome']; if (!empty($nome)) { $condicoes = ("nome" => $nome); } $tipoAnimal =...
asked by 04.09.2014 / 21:23