Questions tagged as 'mysql'

3
answers

Error Search PHP and MySQL Database

I am making a page that looks for information in tables of a MySQL database, the connection is beautiful, but two errors are appearing:    Warning: mysqli_stmt :: bind_param (): Number of variables does not match number of parameters in prepa...
asked by 29.03.2016 / 17:22
1
answer

How to do select in the bank involving foreign key and primary key?

I have a problem, I have two tables that are related to the foreign key and the primary key like this: CREATE TABLE IF NOT EXISTS cargo( id INT AUTO_INCREMENT NOT NULL, nome_cargo varchar(50) not null, "supervisor,gerente, etc..." sal...
asked by 04.04.2016 / 21:07
1
answer

"Syntax error: missing 'semicolon'" in MySQL procedure

I have procedure below CREATE DEFINER='root'@'localhost' PROCEDURE 'SP_notasAluno'(IN aluno INT) BEGIN DECLARE ditCodigo,courseId INT; DECLARE usuario VARCHAR(50); DECLARE notafinaloff,notafinalon,somanotaon float; select gg.i...
asked by 29.03.2016 / 13:34
1
answer

Default Timestamp Mysql

How do I put the value of the field by default timestamp current? I need to alterar my table to add a field timestamp not null which has the current default by default, so all previous records have the current timestamp t...
asked by 02.12.2014 / 14:34
2
answers

Can you use the same query and set two different "ORDER BY"?

I use the following excerpt for one queried to the database $cs1 = $pdo->query("SELECT TITULO, URL, IMAGEM , TEMPO FROM post ORDER BY CLIQUES DESC LIMIT 5")->fetchAll(); I would then like to explore this query further in order to use...
asked by 08.12.2014 / 00:05
2
answers

Error "1146 table 'phpmyadmin.pma__tracking does not exist"

This error prevents me from creating new tables and accessing those already created: Error:    1146 table 'phpmyadmin.pma__tracking does not exist How do I fix this?     
asked by 25.07.2015 / 00:05
1
answer

Generate these results in PHP MySQL

I would like to know how this type of result is generated ... How it is formatted this way. Mes/Ano | Vencidos | A Vencer | Vencendo 01/2015 | 5 | 0 | 0 02/2015 | 1 | 0 | 0 04/2015 | 15 | 0 |...
asked by 22.07.2015 / 22:33
1
answer

Update sql with 2 conditions

I have a table with the STATUZ column This column consists of 3 possible values: NEW, VISUALIZED, DISCARDED I have a function where I need to implement a SQL row that updates my table and changes all the values in the STATUZ column to: D...
asked by 15.07.2015 / 23:39
1
answer

How "preg_match" only numbers?

My failed attempt: $post_id = preg_match("/^[0-9]+$/", $_POST['post_id']);    I tried to be a user who changed the post id for example: post_id="43223646", but when the data is entered in mysql, they are transformed into the number 1, how...
asked by 27.04.2015 / 13:44
2
answers

How to make a SQL query that returns an object instead of an array?

There is not much to talk about. What I need is to know how to do a query that returns an object to me instead of an array in the format: $eventos = [ new Evento(1, new \DateTime('2015-01-26'), 'Titulo #1'), new Evento(2, new \DateTime...
asked by 21.09.2015 / 16:26