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
-
4
votes1
answer5794
viewsUsing mysqli to count records
I need to do a log count. I wore: mysql_num_rows($consulta); How do I do the same thing using mysqli? Because I’m doing it this way: $tabela_usuarios = "SELECT * FROM owner WHERE…
-
4
votes1
answer135
viewserror in mysql_result()
I am again looking for help to understand an error given in a call to mysql_result(), which I cannot solve this error: Warning: mysql_result() expects Parameter 1 to be Resource, Object Given in C:…
-
4
votes2
answers408
viewsLong Polling with mysqli does not return data
The data of data php. file database does not return, if I change the whole data php. for any html text it returns running long Polling, but if I try to use mysqli it returns nothing. What can I do…
-
4
votes2
answers197
viewsHow to detect attempted intrusion?
In order to protect against SQL injection, I need to elaborate a function in which I eliminate the possibility of someone trying to act in bad faith. The question is, mysqli brings with you some…
-
4
votes3
answers619
viewsDELETE FROM users WHERE user_id = $id
I have a script simple PHP+Mysql query: <table > <tr> <td ><h2>GERENCIAR ANUNCIOS </h2></td> </tr> <tr> <td > <table > <tr> <th…
-
4
votes1
answer6781
viewsCalculate distance between 2 points in Google maps
I don’t have much experience with javascript and have no idea how to get the result of this script and move to a field <input text>. This script calculates the distance and time between two…
-
4
votes1
answer7125
viewshow to use mysqli_fetch_array
would like to know how I use this command mysql in my code because I’m trying and nothing I can’t make it work. code: $sql = mysqli_query($mysqli, "SELECT * FROM produtos LIMIT $inicio,…
-
4
votes2
answers21222
viewsSimple record editing with PHP+Mysql
Basically the three scripts should edit a record in the Database: php records.: <?php // Aqui você se conecta ao banco $mysqli = new mysqli('127.0.0.1', 'root', '', 'login'); // Executa uma…
-
4
votes2
answers117
viewsSave Features in BD
I’m starting to work with PHP, MYSQL now and I’ve come up with a question. I am developing a classified site, the same will have categories of vehicles, real estate, electronics, etc... My question…
-
4
votes1
answer69
viewsPHP - Mysqli correct way
I’m starting to use mysqli in my projects, however I saw two ways to make a connection: One of them is simple and equal to mysql_connect $db = mysqli_connect(...); I saw in w3schools. Another is the…
-
4
votes1
answer339
viewsWhen using each data type of mysqli_stmt_bind_param
According to the documentação: i - corresponding variable has type integer d - corresponding variable has type double s - corresponding variable has type string b - corresponding variable is a blob…
-
4
votes1
answer117
views -
4
votes1
answer2544
viewsSelect last JOIN record
I have a table tb_processos and another tb_detalhes (saves details of a particular process), would like to take all the data of the process and only the last detail of the process. The way I’m doing…
-
4
votes1
answer99
viewsPHP BUG - Prepared queries
Good morning everyone, I’m starting in PHP, I follow a course through youtube. I’m studying prepared queries. I have a form that makes a query in the BD, however, when entering the data, the…
-
4
votes1
answer1174
viewsProblem with codeigniter (mysqli) BD connection
Guys, I made a registration form for newsletter. And when loading the database on autoload['libraries'], presents an error Call to Undefined Function mysqli_init() in…
-
4
votes3
answers2377
viewsStructure table day and times (schedule type)
I need to create a table that contains days and hours of operation of an establishment, a kind of agenda. This table should represent every day of the week and on each day contain the opening and…
-
4
votes3
answers296
viewsHow do prepare dynamic and generic with mysqli?
I have a mobile application that sends me the following parameters $tabela = $_POST[“tabela”]; // ex: “pessoa” $atributos = $_POST[“atributos”]; // ex: “codigo, nome, cpf” $valores =…
-
4
votes1
answer164
viewsGrouping arrays hierarchically PHP / Mysql
I have the following structure in a table in the database. My intention is that when I do a select * from in it I can interact up the values so that I have an array in the hierarchical style. That…
-
4
votes2
answers49
views -
4
votes1
answer102
viewsUse of "global" with mysqli leaves the connection open?
In this form of access to the bank with mysqli I was in doubt whether two connections are opened, and whether, after closing the $stmt, if there is still a connection always open. The use is…
-
3
votes1
answer306
viewsPDO deletes columns with equal names
I realized that by using the PDO to execute the query below, the results are conflicting with the PhpMyadmin and the Console do Mysql: SELECT a.*, n.* FROM arquivo AS a INNER JOIN numeracao AS n ON…
-
3
votes1
answer616
viewsPassword security: Should I use Mysqli -> real_escape_string or bind_param?
Mysqli => real_escape_string I want the password storage to be as safe as possible, at the moment I am using only mysqli => real_escape_string: $password = $_POST['password']; $password_safe =…
-
3
votes2
answers327
viewsPHP and Mysqli. Table link problem
I’m following a toturial, it’s all the same. My problem is I can’t connect to the table. connect.php: <?php $db = new mysqli('127.0.0.1', 'user', 'pass', 'app'); if ($db -> connect_errno) {…
-
3
votes2
answers196
viewsHow to write this Mysql code correctly?
I am trying to adapt tomysqli_ sincemysql_ can be discontinued at any time now that new concepts likemysqli_ and Pdo have emerged. I am trying to write this script that pulls the database…
-
3
votes2
answers452
viewsHow to get the sum of three tables in sql
I have 3 tables, being them: Schoolhouse: id, id_escola and nome_escola; Professor: id, id_escola and nome_professor; Students: id, id_escola, sala_aula and numero_alunos; I am aware of the joins,…
-
3
votes1
answer700
viewsMysql returning null improperly - MYSQLI PHP
I’m trying to make a SELECT through PHP mysqli, but it’s returning null in all parameters of the object returned by $mysqli->query($sql). Even so it returns the rows I selected from the table,…
-
3
votes1
answer552
viewsPHP Mysqli Array in select html
I’m a beginner in php and I’m developing a small system for my company and that already serves as a study, because I like this area, doubt is simple, I have the code below: <?php…
-
3
votes3
answers736
viewsMultiple UPDATE from a dynamic field
I’m trying to catch the ids that come by user-selected checkbox (array), and through these ids, update the table, with the following code: $ocs_imp = $_POST['check_imprime']; $contar =…
-
3
votes2
answers950
viewsHow to create Exceptions to handle statement with Mysqli
I’m migrating from PDO to Mysqli and when I was doing some operation with the bank, the verification block was like this: $query = $db->prepare("ppapapa sql sql"); try { $query -> execute();…
-
3
votes1
answer657
viewsRun ECHO without interpreting HTML
I have a value in mysql database that contains some html commands like: <b>Olá</b> <br> Other... I need that when I show the value using <?php echo $row_rs['original']; ?>…
-
3
votes3
answers2513
viewsCan I use "mysql_real_escape_string" on "mysqli_connect" website?
I can use the function mysql_real_escape_string on a website built in mysqli_connect? And if yes makes a difference or the protection would be less? Or should I use mysqli_escape_string? Because…
-
3
votes3
answers447
viewsDivide a date into two parts
I’m making a calendar using Mysql, html, JS and PHP. This calendar serves to book the ballroom here in the building. There may be two reservations on the same day, morning and afternoon that would…
-
3
votes1
answer4727
viewsSelect the 3 highest values
I have a table that has the following data: id_indication, id_user,lg_client A user can indicate multiple clients (lg_client = 1), would like a select that searches for the 3 users that indicated…
-
3
votes3
answers2883
views -
3
votes2
answers10563
viewsFormat/mask CPF in Mysql or PDO
I have a field "Cpf" in my table. This field can be of type INT or VARCHAR, in case you need to change to solve my problem. In it there are only numerical values, without the dots and without hyphen…
-
3
votes2
answers105
viewsData does not appear on the page
I made an OO code in PHP. I used Mysqli for the database and WAMPSERVER as the server, in which I entered data for the table "category". The collation of the bank is "latin2_general_ci". No errors…
-
3
votes1
answer1780
viewsError in SQL query in PHP
I’m having difficulties with an SQL query in PHP, when I make a query I get the following error: Warning: mysqli_fetch_assoc() expects Parameter 1 to be mysqli_result, Boolean Given in C: xampp…
-
3
votes2
answers237
viewsError while uploading photo
I tried to apply the instructions to upload photos to the bank with this article. I just adapted to the Mysqli extension. The connection code below: $conecta = new MySQLi = ("localhost", "root", "",…
-
3
votes3
answers176
viewsSELECT in two tables, with ID separated by comma
Hello! How to make a SELECT that returns data from the first table, whose "id" is separated by commas in the second table? Example: tbl_cores id | cor 1 | azul 2 | verde 3 | amarelo 4 | vermelho…
-
3
votes2
answers6350
viewsView and edit registered data
I created a registration system and wanted to know how I do so that the information that was registered is displayed on the page and that the user can edit them. Follow my code below. <body>…
-
3
votes2
answers419
viewsDoubt with php database connection with mysql
I’m learning about php and mysql, I see several tutorials on the internet and one question that came up is, I see that create several variables and then put these variables in the command, example:…
-
3
votes1
answer427
viewsPHP + Mysqli functions
I created a function in php to the cruid in the database however function Read is in trouble and I can’t understand why, follow the code: function DBRead($table, $params = null, $fields = "*"){…
-
3
votes2
answers485
views -
3
votes2
answers124
viewsMysqli does not run Insert within a function
I have that function: function envia($mensgem) { $odb = mysqli_connect(HOST, USER, PASS, DATABASE); mysqli_query($odb, "INSERT INTO pedidos VALUES ('$mensagem')"); mysqli_close($odb); } I use this…
-
3
votes1
answer247
viewsHow to save data in Mysql using Prepared statments
I’m changing the fields to save date in Mysql, fromvarchar for date, and I was in doubt about the correct way to include the date fields in the database using prepared statments. As DD/MM/YYYY use…
-
3
votes1
answer3453
viewsDoubt about the error "Strict standards: Only variables should be passed by Reference in"
To record some dates in the database in the desired format I am doing so: mysqli_stmt_bind_param ( $stmt, 's', date("Y-m-d", strtotime($data)) ); Or, to catch the present day, simply:…
-
3
votes2
answers519
viewsHow do I pass dynamic parameters in a preparedStatment?
I have a function to enter data into the database dynamically. It worked well when running the query directly using only the function query(), once I started to restructure the function to work with…
-
3
votes1
answer59
views -
3
votes1
answer522
viewsHow to connect tables that are in different databases?
I wonder how I can connect two tables that are in different databases to find data that are similar in the two tables. For example, we can have the table To-do shopping list and table Shopping list,…
-
3
votes1
answer243
viewsPHP - Why should I put an IF in mysqli_prepare()
In the example in Manual PHP was made use of the if before the execution of the instructions. I know that the if is used for comparisons, what comparison is being made here? Follow the example of…