Questions tagged as 'mysql'

1
answer

Insert file set into 2 different tables

I have a situation that I can not resolve, and I would like your help. I have a file-type input on my form where the user selects multiple images at once to upload. I would like to insert 1 of these images into the X table and the rest int...
asked by 22.07.2015 / 02:19
3
answers

error creating table with foreign key mysql

You are giving Can't create table error when creating this table in MySql. I have no idea where the problem is D: CREATE TABLE IF NOT EXISTS 'tbnoticiasrel' ( 'id' bigint(20) NOT NULL AUTO_INCREMENT, 'id_noticia' bigint(20) NOT NULL, 'i...
asked by 23.07.2015 / 16:50
1
answer

How to create an insert trigger

I need to set a trigger so that every time you insert a data into a usuario table, automatically insert the same data into another bkuser table. How can I do this? Use PHP. And how do you invoke trigger ?     
asked by 19.11.2015 / 22:48
2
answers

Comparing variables in a query

I need to create an if to check if the field coming from POST is empty or not, in case I should be null, if I do not seto the value that came in the variable. $query2 = "INSERT INTO tbl_CLIENTES_PF (COD_IDENT_CLIEN, TXT_NATUR_CLIEN, TXT_NACI...
asked by 31.07.2015 / 15:32
1
answer

SQL - Category & Subcategory

I have a category structure and subcategory. And you need to list all categories, and then your subcategories ... But the listing went wrong. I'm using codeigniter . Database Structure: SQLStructure:SELECTc1.*,c2.id,c2.id_categoria,c2.ca...
asked by 13.11.2015 / 01:25
5
answers

Php returns null JSON when accented in MySQL

Hello, I have the following code in php: <?php $con=mysqli_connect("localhost","user","senha","banco"); $parametro = $_GET["parametro"]; if (mysqli_connect_errno()){ echo "Failed to connect to MySQL: " .mysqli_connect_error(); }...
asked by 30.03.2016 / 19:52
2
answers

Error when inserting in bank with PHP

I am trying to insert data into MySQL, no error appears but does not enter the values in the database. <?php INCLUDE "conexao.php"; if (isset($_POST["submit"])) { $cod_produto = $_POST['cod_produto'];...
asked by 12.09.2015 / 03:57
1
answer

Return values from two columns of different tables

I have the STUDENTS table and the TEACHERS table, there are more teachers than students, I wanted to conduct a query that brings students in one column and teachers in another and not all in one. All in one column looks like this: SELECT PK...
asked by 08.06.2015 / 04:51
1
answer

How to use Scope_Identify to return .NET id

I'm developing an application and I need it when sql does the insert return the value of the id that was entered, I'm using the following command SqlCommand cmd = new SqlCommand("insert into solicitacoes (assunto, mensagem, endereco, anexo, st...
asked by 05.06.2015 / 14:31
1
answer

DAO layer with two tables

My question when working with the DAO layer follows the following: As far as I know, each table would refer to a DAO object. But suppose it is necessary to query with select / JOIN , that is, it returns data from more than...
asked by 03.06.2015 / 16:33