Questions tagged as 'mysql'

2
answers

How to escape the percent character (%) in LIKE?

I have a system where I use Laravel to query the database. This is a search form. I use the following code: $search = trim(Input::get('search')); return Empresa::where('nome_fantasia', 'LIKE', $search)->get(); The problem is t...
asked by 16.02.2016 / 19:53
2
answers

How to make a mysql query from an array coming from html?

I know that $cores returns me the values of the form. What is the best way to query the database with the $cores array values to find the cars that are present in that color? <?php //PHP if(isset($_POST['env...
asked by 05.09.2014 / 23:24
1
answer

What is the difference between 'filter_var' and 'filter_input'?

What's the difference between filter_var and filter_input ? I can not find this anywhere, at least not in a way that I understand. And how do I replace mysql_real_escape_string with one of them? $password = mysql_real_...
asked by 25.05.2014 / 03:47
1
answer

Sort column of datatable via query

I'm trying to sort my table by the field name of my database table, but the jquery (datatable) plugin insists on sorting by the id (first field of the table) How to force sorting through the query result, in the case sort by name?     
asked by 03.04.2014 / 19:19
4
answers

Login condition with user or email in the same field

I am creating a system for schools, where the teacher, when registering, inserts data such as name, email, user and password. So far the teacher can log in with email, but I wish I could login with the name too (I made changes but this is giving...
asked by 09.05.2018 / 15:45
4
answers

Error in mysql_fetch_object

I do not know what happens in this error.    Fatal error: Can not use object of type stdClass as array in $result = mysql_query("select * from usuarios"); while ($row = mysql_fetch_object($result)) { echo $row["Id"]; echo $row["Nom...
asked by 18.02.2014 / 19:15
2
answers

Creating tables with database scripts

In my application I have to create a table for each user, the tables are created the first time when the user uploads a file and with the name table_ $ id_user. And the only way I can see to create it dynamically is this: $sql_create_table1 =...
asked by 21.05.2014 / 17:19
1
answer

Problem with group by

I have the following query: SELECT funcionario.*, emprego.data_admissao, emprego.data_saida, emprego.data_dispensa FROM funcionario,emprego,empresa WHERE empresa.id = emprego.id_empresa AND funcionario.id = emprego.id_funcionario AND em...
asked by 20.11.2017 / 17:04
1
answer

Error "Does not have a default value" when trying to insert data in DB [closed]

I was trying to insert the variables I received from a form when I received this error message:    'nidcrespons1' does not have a default value My code: <?php $link = mysqli_connect("localhost", "root", "vertrigo", "winit");...
asked by 22.03.2016 / 18:05
1
answer

How to update fields with fields from another table?

I'm not able to update a table with the select of another. I have a mdl_user table that contains several columns and created another users_sg to copy some columns. I copied with INSERT INTO users_sg (id, username, firstna...
asked by 17.08.2016 / 16:03