The problem is that I have 2 tables in the mysql database, and I need to output values ​​from these tables somehow at the same time.

Currently, one table is connected via

 $sql = "SELECT * FROM `accounts` WHERE `Name` = '%s' AND `pKey` = '%s'"; 

ps In the future, it will be necessary to connect other tables.

  • In a variety of ways. If the data in other tables is somehow related to this, then most likely in the same SQL query describe their interaction and the required result. And if you are not connected, you make separate requests and output data from them in those points of the page where it is necessary. Describe in more detail what you mean by "simultaneous output of values" - Mike
  • I meant that I need to output the values ​​in from two tables. For an example, I print '$ row [' name ']' from the first table, and breddy from the second $ row ['level'] from the second table
  • And this level is somehow connected with this name? - Mike

1 answer 1

If for training, this option is suitable:

 SELECT `accounts`.name, `users`.level FROM `accounts`, `users` 

If the tables are interconnected or you will have thousands of them, then read about table joins (inner join cross join full join, etc.), foreign keys, connections between tables. This is the mat part that is needed when building the database.