Questions tagged as 'mysql'

2
answers

Inserting data using PHP array

I have a table and need to insert data from this table through an array. However gives this error: Notice: Array to string conversion in C:\xampp\htdocs\PhpProject1\salvar.php on line 17 My insert where I filled in the values: CHA,...
asked by 29.09.2017 / 16:49
1
answer

MYSQL and condition

I need to make a select in my database as below: select * from tbl_frete f join tbl_transportador t on f.idtransportador = t.idtransportador join tbl_cliente c on f.idcliente = c.idcliente join tbl_situacaofrete s on f.situacaofrete = s.i...
asked by 08.11.2017 / 02:21
2
answers

Error displaying array in PHP

I have this array in PHP and should display the users name and email field. However, php displays an error message: array(4) { [0]=> object(stdClass)#25 (5) { ["idusuario"]=> string(1) "2"...
asked by 07.10.2017 / 19:10
1
answer

Register sequential number per year PHP [closed]

I wanted to create an automatic numbering record but would reset every year. For example, 170001 ... 170002 and for the year 180001 ... 180002 But with this code I am always registering 1700001 <?php function conectarBanco(){ r...
asked by 19.12.2017 / 13:25
3
answers

Find a certain number inside a mysql string

Good morning everyone. I have a question that I can not solve. In a given table of a BD I have a column that saves a string as follows:    1,2,3,4,5 Line 1   11.22,33,44,55 Line 2 Now you need to do a search to select only rows th...
asked by 20.12.2017 / 12:51
2
answers

Subtract a day directly from CURRENT_DATE [closed]

I'm using a framework that allows me to set the current date as the default value, but now I need to always show the date to yesterday, the code snippet as the value set is this: $editor = new DateTimeEdit('datacadastro_edit', false, 'd-m-Y')...
asked by 24.08.2017 / 19:30
5
answers

Count number of MySQL query records in PHP

I made the code below to count the number of records, but it tells me 1 to 1, I would like to know how I can do to add these records and call with an echo. ?> <?php $sql="SELECT id FROM processo"; $return = $conexao->...
asked by 25.08.2017 / 17:32
1
answer

How to make a dropdown that imports the database options

I have a student enrollment form and one for enrollment of these students in classes. To enroll the student in the class, I would like to have a dropdown where I could select one of the registered students, I thought it could be something sim...
asked by 25.08.2017 / 14:39
1
answer

How to execute the same query for different "ids"

I have an array with the following IDs: Array ( [0] => 2 ) Array ( [0] => 3 ) Array ( [0] => 5 ) The query should return all the values found for these IDs, so what will be the assembly of query [using PDO]?     
asked by 25.08.2017 / 01:20
1
answer

MYSQLI - Trying to get property of non-object in

I have the following function: function sql_update_views ($table = null, $id = null) { $database = open_database(); $found = null; try { $sql = "UPDATE ".$table." SET views = views + 1 WHERE id = ".$id; $result = $d...
asked by 24.08.2017 / 23:18