Questions tagged as 'mysqli'

4
answers

Include UTF-8 charset in mysqli connection

Hello, after repairing my code is full of strange characters like ???, I tried to fix it but I discovered that I need to change the charset through the mysqli connection, but the problem is that I do not know how to do this! Can anyone help m...
asked by 30.07.2015 / 20:37
2
answers

How to set date ('d / m / Y H: i: s') with Brasília time instead of server time

I'm writing the date and time in the database with script : $sql = "INSERT INTO admin_users (user_name, user_password_hash, user_email, user_data) VALUES('" . $user_name . "', '" . $user_password_hash . "', '" . $user_...
asked by 11.02.2015 / 17:27
2
answers

MySQL Auto increment number pair

I have a MySQL database with a id field that is AUTO_INCREMENT . You have some configuration problem in it because at the time of making the auto increment it is coming out exactly in this sequence: ID: 2 ID: 12 ID: 22 ID: 32 ID: 42...
asked by 10.02.2017 / 14:59
2
answers

foreach can replace fetch_array?

I saw in a video that the guy takes the query and plays it right in the foreach and can list without any problem, my question is this: if it really is possible, using only the foreach would be much more practical than using while with fetch_arra...
asked by 24.07.2016 / 22:03
3
answers

How to retrieve ID of the last record recorded with MySQLi

I am not able to retrieve the ID of the last record inserted in my DB, it is coming as Zero, the inclusion is working and at the moment of making an update the script fails. I have tried with mysql_insert_id() and mysqli_insert_id()...
asked by 13.05.2015 / 15:36
2
answers

How to loop with while using array

Hello, I would like to know if it is possible to loop using while so I need the values of the $newsmedias1 array to be placed in while in order to make the appearance of the items with the given IDS in the Array as lo...
asked by 22.10.2015 / 15:41
2
answers

JOIN with two columns in the same table

Good morning. How do I make a JOIN, two column in the same table? In the quote table, you have the column with the ogirem and destination cpf_cnpj. SELECT cotacao.*, clienteOrigem.ID_Cliente as origemIdcliente, clienteO...
asked by 16.06.2015 / 17:23
2
answers

SQL Query Optimization in MySQL and Index

I have a performance problem with a query with SQL on MySQL that is using my server a lot, I have done index and even then the consumption does not decrease. The query I'm using is: SELECT CONCAT( '2015-10-14 '...
asked by 14.10.2015 / 15:52
2
answers

Insert data into database according to number of checkboxes

I have form where I have fields with chekboxes and I want to know if it is possible to make as many inserts as selected fields. In other words, if the user chooses 4% with% I make 4% with%, is it possible? If so, how can I do it?...
asked by 29.01.2015 / 19:26
1
answer

How to use prepared statements with external variables in MySQLi

I have the following code, in which I want to use prepared statments : prepare.php : <?php include "../conex.php"; // conecta mysqli_set_charset($mysqli,"utf8"); // Transforma em UTF8 pra gravar acentos no servidor // Inser...
asked by 24.09.2015 / 00:46