Most voted "mysqli" questions
The Mysqli extension (Mysql Improved) is a relational database driver used in the PHP programming language to provide an interface with Mysql.
Learn more…945 questions
Sort by count of
-
3
votes1
answer82
viewsHow to insert a variable into an array?
I want to enter data in my database I’m using mysqli, I need to know how to indicate inside an array a variable, here and my code I want to know if this is the correct way to do it require…
-
3
votes2
answers172
viewsIs it worth 'shuffle' ID that will be passed via URL?
We were talking about database security. Came the question: worth encrypting Ids coming from the database to the frontend? E.g.: I click on a client from a list where the link goes…
-
3
votes1
answer580
viewsWhat is the difference between SQL Server, Mysql and other SQL?
I would like to know more clearly what are the main differences between SQL Server, PL/SQL and Mysql, and what are their main strengths/weaknesses.
-
3
votes2
answers254
viewsGroup By different results
Hi, I have a question if anyone can help me on SQL. I know the Group By clause, as far as I know it groups similar data. But I understand that it should group but in the script below it has the…
-
3
votes2
answers57
viewsHow to keep the variable with the same value in the database?
I have a question in the code below: <?php include "conexao.php"; $id = $_POST["id"]; $nome = isset((trim(ucwords($_POST["nome"])))) : (trim(ucwords($_POST["nome"]))) : $apelido =…
-
3
votes1
answer511
viewsFailed to register NULL value in database - PHP7
Good night to you all, I am a beginner and I am developing a registration system for CATEGORIES and SUBCATEGORIES in PHP7 and MYSQL; The logic I used to register Categories and Subcategories is:…
-
3
votes0
answers233
viewsHelp with ABC curve creation in Mysql
I set up a select to know how many products were sold in a given period and the sale value of those products. Only I need to mount an ABC curve with the result of this select. Could someone please…
-
3
votes1
answer629
viewsParam Bind with Array - PHP and Mysqli
I have the code: <?php $clientes = implode(', ', $clientes); $busca = $mysqli->prepare("SELECT nome FROM clientes WHERE id IN (?)"); $busca->bind_param("s", $clientes);…
-
3
votes1
answer1035
viewsSlow datatable when loading many results
I have a database with about 500 records with system orders, however I need to display these records in Datatable for better organization and research. Loading the page takes too long to display the…
-
3
votes1
answer226
viewsExchange %20 for + in GET search
When I do a search via GET through a form the url looks like this: test.com.br? search.php? q=Phrase%20what%20am%20searching I’d like to keep it that way: test.com.br? search.php? q=Phrase+what+am…
-
3
votes1
answer31
viewsLogin using Prepared Statements from Mysqli returns error
I’m, for the first time, using Prepared statements. I am confused and do not know why is not returning the authenticated user. Follow my code: index php. <form method="post"…
-
3
votes2
answers299
viewsDo I need to open a Mysql connection for each PHP query?
I need to get several variables based on my bank to mount a full Dashboard. For example, I need the number of lines, the average value of a given field and the same average value only per FU. The…
-
3
votes1
answer77
viewsDelete records in 2 tables with only 1 DELETE command
Model of the structure of the tables: Tabela: Produtos id_produto titulo_produto descricao_produto Tabela: Fotos id_foto descricao_foto id_produto We can observe that the tables have in common the…
-
3
votes1
answer50
viewsDifference between conventional SELECT and INNER JOIN
Model of the structure of the tables: Tabela: Bancos Cod Nome Tabela: OperacoesBanco Cod CodBanco ValorOp Historico Well I have these two models of SELECT: Example 1 SELECT b.Nome, o.ValorOp,…
-
2
votes6
answers16533
viewsHow to mount the HTML of a "select" via PHP, using data from DB
I’m having trouble properly assembling a <select> within PHP, with data returned by mysqli. I tried this way: <?php $con = new mysqli("localhost", "root", "senha","bancodedados" ) or die…
-
2
votes4
answers430
viewsPHP class for interaction with Mysql BD
Does anyone know any PHP class for Mysql integration, using the function mysqli_* and Prepared statements? I have these two examples: Mysqlidb Mysqli Database…
-
2
votes2
answers1625
viewsHow to make an empty select to pull all results from column
I’m trying to make an empty select, which if no option selected pulls all the results, using the AND in the SELECT form forces me to choose some option, how can I resolve this? Follows the codes:…
-
2
votes1
answer320
viewsMysqli SUM query does not return result
I am trying to sum up a column using the mysqli SUM method. The problem is that my query does not return results. My code is this: $sql = 'SELECT SUM(size) as soma, porta FROM `'…
-
2
votes1
answer847
viewserror in mysqli query
Person, how I fix this my code, it is giving error: <?php //IMPRIME TODOS OS VALORES DO BANCO CADASTRO $servidor = "localhost"; $usuario = "root"; $senha = "admin"; $banco = "cadastro";…
-
2
votes4
answers1666
viewsSQL Injection via url
At the moment my site is as www.site.com.br/blablabla_id_2 for the definition of pages. I use mysqli to do database searches with this id. $id = $_GET['id']; $result = mysqli_query($con,"SELECT *…
-
2
votes3
answers275
viewsHow to make a php script inserted into a page through a "require" run from time to time?
In the answers to question of the link below I posted how I managed to delete from the database the user information that not activate in up to 24h your registration through the link sent to your…
-
2
votes2
answers229
viewsView how many people accessed pdf
I have a pdf on my server and I put it available through a link, there is way to control how many people access the pdf?
-
2
votes1
answer1327
viewsHow to "preg_match" only numbers?
My attempt, a failure: $post_id = preg_match("/^[0-9]+$/", $_POST['post_id']); I tried to be a user who changed the id of the post to for example: post_id="43223646", However, when the data is…
-
2
votes3
answers55
views -
2
votes3
answers179
viewsWhy ismysqli_ better thanmysql_?
I would like to know what are the advantages mysqli_ has in relation to mysql_, because they keep suggesting me to pass to mysqli_.
-
2
votes2
answers42
viewsDoubt Mysqli Parameter new_link
The old PHP function mysql_connect possessed the parameter new_link which allowed connection to several different banks in the same script: Example: $connect =…
-
2
votes1
answer604
viewsStore Variable within a While
I’m having a simple doubt but it’s cracking my head: I have a form where there are several checkbox, the checkbox value is an id number, I would like to create something that when the user selects a…
-
2
votes3
answers98
viewsSearch by selection field
I am creating filters to search for products, having all the products visible, I would like to know how I can make a selection field and by the category that the user chose would only appear…
-
2
votes0
answers493
viewsHow to use tags in Mysql and PHP
I am creating a website and would like to know how I can use tags with Mysql and PHP. I have two tables: produtos and informacao. On the table informacao I have a field called related products where…
-
2
votes1
answer1572
viewsHow to use mysql_result with Mysqli?
I’d like to know how to use the mysql_result in the mysqli I’m not getting it, I was looking at the site php.net and the only thing I saw was a mysqli_data_seek if anyone can help me... Code I’d…
-
2
votes2
answers1631
viewsCheck if data already exists in codeigniter bank
I’m starting with codeigniter using active record to make the conversation with the bank, and wanted to know how to know if an email already exists in db, would have to list all email and create a…
-
2
votes1
answer265
viewsStandardization for Mysqli use
I’m researching the use of Mysqli and have seen many articles, but each one always has some particularities about the development pattern, my question has anyone defined a pattern? For example…
-
2
votes1
answer2994
viewsDisplay mysqli error using die
Wore mysql_query, as it is no longer used I am using the MySQLi. That left me with a question. To display query error by DIE that’s how you do it? $sql = $mysqli->query("SELECT * Fron tabela") or…
-
2
votes1
answer1972
viewsPerform mysql query of two tables via php
Good afternoon guys. I have a problem that I don’t know how to solve anymore. I have the following mysql query in php: mysql_select_db("banco", $conexao); $resultado = mysql_query("SELECT * FROM…
-
2
votes1
answer757
viewsHow to fetch values only from the checkbox selected in codeigniter
I have dynamic checkbox, and wanted to fetch the values of the ones that are selected, how to do this with codigniter: Model to go to the fields and create the required checkbox: public function…
-
2
votes1
answer2360
viewsUpdate several fields and values in the same table
I’m making a very simple system for inventory control, and in the part of editing the products, I’m doing it this way: I do a query in a database, and I list text fields with the name of the…
-
2
votes4
answers1229
viewsIs there any way to display the result of a query(mysqli) in the form of HTML?
I have already searched intensively for a solution to show the result of a mysqli query inside an html one, but I can’t find anything. I saw that it is possible to present the result through one…
-
2
votes3
answers451
viewsExchange Postgresql connection for Mysql connection
I found a project made in PHP OO to be used in Postgresql with this connection. <?php class BD { public function __construct() { pg_connect("host=localhost port=5432 user=usuario password=senha…
-
2
votes1
answer1762
viewsAutocomplete: JSON + PHP
With the codes below my output coming after typing "Al" is only "Albania", and the same comes duplicated in the autocomplete. The result coming in Chrome console is: >…
-
2
votes2
answers828
viewsHow to differentiate data from two tables with columns of equal names in an SQL request with JOIN?
I combined record of two tables using JOIN, the two tables have some columns with equal names... When extracting data with PHP how will I differentiate ? Example : foreach($dados as $values){ echo…
-
2
votes2
answers2838
viewsWrite data to two tables from a PHP form
Connection with the comic $host = "localhost"; $user = "root"; $pass = ""; $conexao = mysqli_connect($host, $user, $pass) or die (mysql_error()); mysqli_select_db($conexao, "teste2"); HTML…
-
2
votes2
answers64
views1054 - Unknow colunm in on clause
what’s wrong with this consultation? SELECT clientes.idClientes, clientes.nome, clientes.bloqueado, planosclientes.idPlanos, planos.nome, enderecos.bairro, enderecos.cidade FROM planosclientes INNER…
-
2
votes1
answer344
viewsIs it possible to list the columns used in a SELECT in PHP mysqli?
I have the query SELECT coluna1, coluna2... FROM tabela I wonder if there’s any method in the class mysqli to return these columns that were used in the query, even if the query does not return…
-
2
votes2
answers206
viewsMysqli multi_query INSERT + insert_id multiples tables autoincrement + Foreign key
I have 2 tables for example a table "users" containing a primary key ID user and other table "details" with a foreign key do usuario.ID My need would be for php to do for example in a single query o…
-
2
votes1
answer52
viewsMysqli cannot return methods
I am changing my PDO application to Mysqli since I will only use SQL even. I create the connection on the main controller so others can open it: class Controller { function __construct() { } public…
-
2
votes1
answer2328
viewsMysql connection error: Headers and client library minor version Mismatch
When connecting to MYSQL database using mysqli class I am getting error: Warning: mysqli::mysqli(): Headers and client library minor version Mismatch. The error occurs when PHP version 5.4.16 is…
-
2
votes2
answers134
viewshow to use Order by in ENUM
Hello would like to know how to use the ORDER BY to do the following in my SQL table category column module I have a ENUM with the following modes 'media','filme','ova' would like to make an…
-
2
votes1
answer561
viewsAdd X days on a predefined date in Mysql
I need to create a deadline, an access expiration date in the case I am using to capture the current time the "criado" datetime DEFAULT CURRENT_TIMESTAMP, Where I use the CURRENT_TIMESTAMP to get…
-
2
votes1
answer254
viewsConvert Mysql to Mysqli
3 Errors are presented: Notice: Undefined variable: save in C: xampp htdocs index.php on line 6 Warning: mysql_num_rows() expects Parameter 1 to be Resource, Boolean Given in C: xampp htdocs…
-
2
votes0
answers86
viewsHelp with Mysqli procedural to object-oriented class migration
Hello, good afternoon. I started to migrate a Mysqli class from procedural to Object Oriented and two functions of that class left me in doubt. During the migration of functions fetchRow and…