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
-
70
votes5
answers17559
viewsMysqli vs PDO - which is the most recommended one to use?
With the mysql_* entering the state deprecated, the PHP documentation recommends using PDO and Mysqli. What do you recommend for use? PDO seems to be best suited for working with object oriented…
-
15
votes1
answer2407
viewsHow to update my Mysql code to Mysqli?
I have codes that use mysql and need to upgrade to mysqli. I need to make two changes, being them on the pages .php which insert the data into the database table and also into the pages displaying…
-
11
votes3
answers9405
viewsHow to convert a Mysql connection to Mysqli?
I decided to listen to some users to make the conversion but I need your help because I have done a lot of research and nothing works. The first file is: <?php…
-
10
votes4
answers24249
viewsWhat is the right way to connect to the Mysqli database
I have a question that has brought me several incompatibilities. With the evolution of PHP and Mysql, more recent versions have emerged, this way Mysqli. That’s where my problem lies, I would like…
-
10
votes1
answer3509
viewsSelect with Prepared statements Mysqli
//// The connection is like Mysqli was passed by the constructor method and assigned the variable $db; public function getById($id) { $query = $this -> db -> prepare("SELECT * FROM tabela…
-
9
votes2
answers42711
viewsHow to set date(’d/m/Y H:i:s') with Brasilia time instead of server time
I’m recording the date and time in the database with the script: $sql = "INSERT INTO admin_users (user_name, user_password_hash, user_email, user_data) VALUES('" . $user_name . "', '" .…
-
9
votes4
answers12072
viewsInclude UTF-8 charset in mysqli connection
Hello, after noticing that my code is full of strange characters like ??? I tried to fix it but found I need to change the charset through the mysqli connection, but the problem is I don’t know how…
-
9
votes2
answers1340
viewsSmart Query with Mysql
I’m trying to make a "smarter" query on my DB, my doubt is as? I have a query: SELECT * from publicacao where titulo like '%$busca%'; and in my DB has several publishing titles, for example:…
-
9
votes9
answers12142
viewsSearch via ajax during input text ( autocomplete )
I did a search using ajax that when clicking a button triggers a request with the term searched and returns with data that fills a combobox html (select). So far so good. However, I found it…
-
8
votes1
answer299
viewsPrepared statements with Mysqli does not require validation of data entry?
I was studying here about security in PHP & Mysqli, and I was left with a question: if I am using prepared statments, still need to validate data entry? For example, I have a field in the form:…
-
8
votes0
answers72
viewsSELECT to get many lines in PHP
I’m a beginner in PHP and Mysql and need to know what I do to get all users registered in a database when the number of users reaches thousands? I registered 300,000 users in my database and would…
-
7
votes2
answers1493
views -
7
votes1
answer230
views -
7
votes1
answer245
views -
7
votes1
answer1742
viewsIs there a risk in using mysqli_insert_id?
Suppose a website with a relatively high flow. An X user inserts a record into the database at the same time as another Y user inserts another record. Whereas the procedure of this insertion of user…
-
7
votes1
answer1010
viewsPHP - Make 3 INSERT in different tables with relationship between them
I’d like your approval. I need to do 3 INSERT all at once. Only I also need to get the last ID of each table, to do the relationship of the tables. That’s right, do it that way? if($_GET['operacao']…
-
6
votes2
answers19743
viewsWarning: mysqli_fetch_assoc() expects Parameter 1 to be mysqli_result, Boolean Given in
I’m having a simple problem when it comes time to take a dice from a table.. The mistake is Warning: mysqli_fetch_assoc() expects Parameter 1 to be mysqli_result, Boolean Given in Code: $sql =…
-
6
votes2
answers262
viewsInsert data into database according to number of checkboxes
I have a form where I have fields with chekboxes and I want to know if it is possible to do so many inserts as selected fields. That is if the user selects 4 checkboxes do 4 inserts, is possible? If…
-
6
votes0
answers254
viewsHow to create PHP function to recover password?
I use 2 pages, one to insert the email (forgotPassword.php) that still only has graphic design. And the recuperar.php which will serve for the user to change his password. My user table (where the…
-
6
votes3
answers3860
viewsHow to rescue ID from last record recorded with Mysqli
I am unable to rescue the ID from the last record inserted in my BD, it is coming as Zero, the inclusion is working and at the time of doing an update the script fails. I’ve tried with…
-
6
votes2
answers2492
viewsJOIN with two columns in the same table
Good morning. How can I make a two column JOIN in the same table? On the table quotation, has the column with cpf_cnpj from warhead and fate. SELECT cotacao.*, clienteOrigem.ID_Cliente as…
-
6
votes2
answers1107
viewsforeach can replace fetch_array?
I saw in a video that the guy takes the query and plays straight in foreach and manages to list without any problem, my doubt is the following: if really possible, using only foreach would be much…
-
6
votes1
answer439
viewsHow to use Prepared statements with external variables in Mysqli
I have the following code, which I want to use prepared statments: prepare.php: <?php include "../conex.php"; // conecta mysqli_set_charset($mysqli,"utf8"); // Transforma em UTF8 pra gravar…
-
6
votes2
answers188
viewsSQL Query Optimization in Mysql and Index
Guys I’m having a performance problem at a consultation SQL in the MySQL who is using my server a lot, I’ve done index and yet consumption does not decrease. The query I’m using is: SELECT CONCAT(…
-
6
votes2
answers1244
viewsHow to loop with while using array
Ola would like to know if it is possible to make a loop using while as follows I need the array values $newsmedias1 be placed in the while in order to perform the appearance of items with the IDS…
-
6
votes2
answers531
viewsMysql Auto increment even number
I have a Mysql database with a field id that is AUTO_INCREMENT. Has some configuration problem in it because when doing auto increment is coming out exactly in this sequence: ID: 2 ID: 12 ID: 22 ID:…
-
6
votes4
answers668
viewsRetrieve dynamic input and insert into the bank with Procedure
I’m having trouble inserting incoming data from a dynamic input. My Procedure only inserts once, follows my code where I receive the data: $ddd = $_POST['ddd']; $userid = $_POST['userid'];…
-
6
votes0
answers54
viewsRedirect a virtual url
How do I redirect a url from my website to a subfolder. Example: Database: ID | ENDEREÇO | ESCREVER NO INDEX.PHP 1 | example.com/extranet | <span>Sou o extranet</span> 2 |…
-
6
votes3
answers658
viewsPass SQL output to JSON
Hello, I want to pass the result of a select to json, but I can’t check why I can’t see it. So someone could tell me why this code doesn’t print anything? include_once 'conexao.php'; $query =…
-
6
votes2
answers1351
viewsError "expects Parameter 1 to be mysqli, string Given in"
I am creating an Insert form for registration, but when I click on the button it is showing me error: Warning: mysqli_query() expects Parameter 1 to be mysqli, string Given in C: wamp64 www Beauty…
-
6
votes2
answers1019
viewsselect bringing all un-duplicated records based on a single column
How can I bring all records from a column that are not repeated. For example: | tela | url | perfil | dataCriacao | --------------------------------------------- | dica | /dica/ | ROLE_CDL |…
-
5
votes2
answers1352
viewsAlways presents an error when I try to use the mysqli expression
I know the expression mysql was discontinued, so I’m trying to use the expression mysqli, but every time I try to show myself on the screen a syntax error! example: $buscaDados =…
-
5
votes2
answers473
viewsHow do I use echo in a query with Prepared statement?
I would like to know how to use echo in a query with Prepared statement, to be able to visualize how it was mounted by php before it was executed, thus facilitating the visualization of the error at…
-
5
votes2
answers6602
viewsInsert data into database using mysqli
How do I insert this data into the database mysqli: print $data->access_token."<br />"; print $data->username."<br />"; print $data->full_name."<br />"; print…
-
5
votes2
answers6653
viewsMysql Commands out of Sync; you can’t run this command now
I have a class Import (PHP) which is used to read XML files and insert into the BD. First I got the class builder Import that creates a new connection mysqli: ... $this->mysqli = new mysqli(…
-
5
votes4
answers1111
viewsHow to delete the database registration if the user does not activate it by email within "X" hours?
Well, when registering on the site the user has its ACTIVE set to 0, so with the code I posted in the answer of the question link below I can update the ACTIVE to 1: How to enable a user’s email…
-
5
votes1
answer420
viewsDoubt about relationship between tables in mysql
I have the following tables: Table: Customers Table: Interests of the client Table: User In the client interests table, I need to enter the user id and the client id as foreign keys, the user id…
mysqliasked 9 years ago Igor Silva 661 -
5
votes1
answer11274
viewsHow to insert data into two tables at the same time?
I need to make an insertion as follows: I have two tables TABELA 1 and TABELA 2 and a cadre form. This form has three inputs: input 1, input 2, input 3 The input 1 shall be inserted into TABELA 1.…
-
5
votes5
answers6496
viewsDoes not record records in my database
I created a registration system, but when I click the sign up button appears the message "Could not insert record:"... Someone can identify this error as I have so far been unable to identify it.…
-
5
votes2
answers301
views -
5
votes2
answers211
viewsPHP - Bring the result of a table according to the most recent message from another table?
So.. I have 3 table: user: | ID | NOME | SOBRENOME | | 01 | Igor | Ferreira | | 02 | João | Henrique | | 03 | Rose | Beltão | following: | ID | user1_id | user2_id | | 01 | 01 | 02 | User 1 >…
-
5
votes3
answers3563
viewsmysqli_escape_string() expects Exactly 2 Parameters, 1 Given
I am facing an error in my code, when I run the server behavior of DW C6, when the step of mysql_ for mysqli_, then I get an error in the function executed on line 10. The mistake is: Warning:…
-
5
votes2
answers30215
viewshow does auto increment work in mysql?
I want to know how to add a column so that it is primary key and auto-increment, but that the value is higher, example: ID :3509. and not just 1,2,3,4...etc.…
-
5
votes1
answer759
viewsPHP with DAO + mysqli
DAO necessarily needs to be a class? Or I could create methods within a file. php without encapsulation of a class? If not possible, what is the name of the classless DAO (name of some pattern equal…
-
5
votes2
answers2142
viewsLogic to validate free schedules on schedule
good night! I’m stuck for a few days in the following situation, I’m not able to parameterize or create an expression that validates interval between dates, which works like this: that is, if you…
-
5
votes1
answer167
viewsMemory overflow with mysqli_query
The following instruction stopped the program: $result = mysqli_query($db, 'SELECT * FROM base'); And returned the following error: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted…
-
5
votes2
answers150
viewsAdd values from a select when repeat client id
How I could sum the values of a select when repeating the account id? Example I use that select: $servername = "localhost"; $username = "username"; $password = "password"; $dbname = "myDB"; //…
-
4
votes3
answers1909
viewsError creating a Mysqli database via PHP on Wampserver
I’m having trouble creating the database, on the net I found little content on, I only find how to build database by phpMyAdmin, but it is via script that I want to create. I have the following…
-
4
votes1
answer99
viewsmysqli_result Object ( )
I’ve spent the last three hours trying to find the error... maybe it’s sleep, but I’ll put my very complicated script so someone can shed some light. $query_passaporte = "SELECT num_compra,…
-
4
votes2
answers6461
viewsSelect in Mysql with an array
I have a form with a field multiple select: <form action="processa-chose.php" method="post"> <select id="selecionar" name="fornecedor[]" data-placeholder="Fabricantes" style="width:350px;"…