Questions tagged as 'sql'

1
answer

Error: There are no primary or candidate keys in the referenced table

I'm trying to create a new table in an existing DB, however, the following message appears:    There are no primary or candidate keys in the referenced table   'match_contact_current' that match the referencing column list in   the foreign ke...
asked by 09.03.2015 / 15:04
2
answers

Use ON CASCADE DELETE in SQL

I have two tables in SQL, one called Sick and another Diagnostic, I can do all the operations with the diagnostics (insert, edit and delete), but I just wish it were possible to delete the diagnoses that were not associated with a patient . F...
asked by 10.02.2015 / 16:00
2
answers

While not stopping when you should

I have the following code: <div class="row"> <? $tag = mysqli_real_escape_string($connection,$_GET['categoria']); $result = $connection -> query("select * from produtos where tags like '%$tag%' and online='0' order by id limit 4...
asked by 19.01.2015 / 23:49
2
answers

How can I use the UPDATE command between two tables?

I'm trying to update the GRUPO field from the ESTOQUE table to the value 1 (one) when the NCM field of the EST_ADICIONAIS table is equal to 21011000 . Therefore, both tables have the CODIGO field with equ...
asked by 26.03.2015 / 15:49
1
answer

What is the purpose of creating the folder and not uploading the image in sequence? [closed]

if ($_POST['salvar']) { $titulo = $_POST['titulo']; $conteudo = $_POST['conteudo']; $imagem = $_POST['imagem']; // titulo duplicado $sql = "SELECT * FROM noticias WHERE (titulo=:titulo)"; $stmt = DB::prepare($sql); $stmt->bindParam("titulo",...
asked by 04.01.2015 / 00:53
1
answer

Problem with accentuation when entering data in SQLite android

I'm trying to give insert in a table, however it gives syntax error. I believe it's because of the accent, but even researching can not solve. Error log:    11-19 00: 34: 52.959: W / AQuery (21157):   reporting: android.database.sql...
asked by 19.11.2014 / 04:37
1
answer

Return with different values in JSON / PHP

Scenario: I have a query made in PHP and I need to return it to my iOS app in JSON format. However when doing some tests, in the browser, I noticed that using the echo json_enconde($resultado); function returns less results on the screen....
asked by 21.10.2014 / 16:02
1
answer

Use distinct in row

Well, I'm having a question, I'm trying to return from bd only the states that have the term searched for, but I do not want any repeats. follow the code <?php $search_term = filter_var($_GET["s"], FILTER_SANITIZE_STRING); $q = "SELECT DIST...
asked by 22.08.2014 / 21:43
1
answer

Select saves the same data in 2 different fields

I need to know that when the employee selects the product the "product code" is automatically populated, so far so good, but when I write the data in the DB, the product and product_code have the same data (in this case the product code)....
asked by 09.09.2014 / 15:00
1
answer

Change part of all records of two columns through a reference

Good evening, everyone! I am noob in SQL and I want to strive to learn more with your help. Details: The columns belong to the same table The part of the record to be taken is common on all rows, that is, this would be the re...
asked by 26.02.2015 / 00:54