mysqli

The while loop in the function while() function in php

Hello everyone. I apologize for such a stupid question: how can I put a while loop in a function if the loop accesses the dat ... ion all_list(){ while($row = mysqli_fetch_assoc($all)){ echo $row['id']; } } echo all_list(); ?>

How do I set up the correct encoding for MySQL?

Here... I'm learning PHP. I reached the connection to the database. And here's the problem. In the *.php file, I register a c ... irl needs programming here. We have already talked about this issue. I study - so it is necessary. Thanks for understanding:)

Fate date value in MySQL update

The MySQL table has a datetime field that stores the date (the pay field) before which the user paid for access to the site. ... possible somehow should I include this in the request? In order not to "pull" the table first by extracting the value of pay

php user registration, checking the uniqueness of values

I'm doing user registration for my site, I'm learning php not so long ago. I get the data from the form -> then I check t ... what data. If anyone has examples from practice and code on how best to do user registration today, I will be very grateful.

Mysqli set charset () refuses to work

Hello. I can't figure out why the function refuses to work. $db->set_charset("utf-8"); Returns false for some reason. The ... ding refuses to change. I tried for the sake of experiment to change to some windows-1251 - also does not work. Where to dig?

Mysqli output

Tell me how to output the record? I'm new to MySQLi in mysql, I know it well) I looked at the syntax is almost the same, but ... ;"; while($user = mysqli_fetch_assoc($result)) { echo {$user['name']}; } ?> Tell me where the errors are) Thanks.

I tried everything, but when the page is updated, it resumes sending the form

I have sent data from the form, everything is fine, it is added to the database, I also output data from the database to the ... dy sent by) I reread a lot of options on the Internet, nothing helped, I think there is some error in my code. Please help me

Find out the ID (AUTO INCREMENT)

Hello. There is a MySQL query: $mysqli->query("INSERT INTO `test_table` (`name`) VALUES ('test')"); Structure of the test ... is, the ID will be set automatically for this request. How do I know it? That is, I need to find out the Id that was set.

Parse mysqli query

Here's what print_r($query) outputs mysqli_result Object ( [current_field] => 0 [field_count] => 2 [lengths] => [num ... rom the table data. Added: Request: $query = mysqli_query($db, "SELECT * FROM `company` WHERE `auto_numbers` = 'В132СВ47'");

Email mailing list from MySQL to PHP7 with Redbeanphp

You need to implement a newsletter to registered users of the site. I ran into such a problem that neither on the forums nor ... ll work on PHP7 - where all emails-array are in the variable $usermail (That is, without a connection to the database, etc.)

Do prepared expressions/variables completely protect against SQL injection?

The world has long used mysqli and PDO. Many people actively promote them: there are prepared variables, everything becomes s ... it does, then... I'm shocked)) P.S. Perhaps this question has already been considered, I don't know, I'm sorry in advance.

How to combine 2 tables into one with 2 MySQL fields

Please tell me how to make a request. I need to select the same values of the fields userid and fuserid from 2 tables. SELE ... isplayed in different columns. Type: [457281][457281] или [NULL][457281] или [457281][NULL] How can this be achieved?

MySQL AS how to read data correctly

Good time of day. Faced with such questions. Creating a simple query with a selection of data from mysql SELECT name, name2 ... .name as name, t2.name2 as name2 FROM table1 AS t1 INNER JOIN table2 AS t2 ON t1.id = t2.id ... $row['name'] $row['name2']

Adding records to the database via PHP

First, in my code, the entry in the database is added through the form for some reason, but not in all fields. In the table ... ES (NULL, 'Dinn', '[email protected]', MD5('123'), '0.00', INET_ATON('127.0.0.1'), UNIX_TIMESTAMP())"); $mysqli->close();*/

How to invert a table with a single query

There is a table in which data is written in two columns (start, end) in date format, and each entry means that the time interval between these two days is occupied. How can I create a query that shows free (unoccupied) days?

Connection class. Query. PHP class

There are two classes The first one <?php class Connection { protected $connection; private $host; priva ... obj as mysqli_connect, how to change the code so that it recognizes $obj. And what would you recommend to change in the code?

Php safemysql class get insert id

How can I use of this class to get the insert id of the request? $sql = "INSERT INTO domains SET name = ?s, license = ?s, enddate = ?s, session = ?s"; $db->query($sql,$name,$code,$ends,"begin"); die($db->insert_id);

Does not write to the database

Here is the code actually: <?php session_start(); include_once("admin.php"); if(isset($_POST['step']) == "4") { $ ... ritten. the data before entering into the database-output, they are transmitted, but not all are written. What's the problem?

SQL query with condition (unequal)

There is a code: mysqli_query($db, "SELECT * FROM tb_users WHERE (name LIKE '%$user%' OR username LIKE '%$user%') AND user_i ... code so that it works correctly, that is, how do I make the code correctly with the condition that user_id is not equal to 1

Why is the error Call to a member function getRow() on null in?

When using this library: https://github.com/colshrapnel/safemysql/blob/master/safemysql.class.php Calling the function: $id ... ECT * FROM table WHERE id=?i", $id); The error comes out: Call to a member function getRow () on null in why, how to solve?