There are two files, index.php and open.php. The first page itself, the second contains SELECT itself. The reason why is this: for testing in documents. If something is written incorrectly or incorrectly, I apologize in advance.
Pieces of code:
<div class="part"> <div class="content"> <a href="open.php"><img src="pic/example.png"/></a> Name1 </div> <div class="content"> <a href=""><img src="pic/example.png"/></a> Name2 </div> <div class="content"> <a href=""><img src="pic/example.png"/></a> Name3 </div> <div class="content"> <a href=""><img src="pic/example.png"/></a> Name4 </div> <div class="content"> <a href=""><img src="pic/example.png"/></a> Name5 </div> </div> <?php require("connect.php"); try { $pdo = new PDO($dsn, $user, $pass, $options); } catch (\PDOException $e) { throw new \PDOException($e->getMessage(), (int)$e->getCode()); } $data = $pdo->query('SELECT * FROM Partners WHERE NAME="Name" AND STAR="2" AND COLOR="Red"'); while ($oneRow = $data->fetch()){ echo '<br/>'.'Name: '.$oneRow['NAME'].'<br/>'.'Star:'.$oneRow['STAR']. '<br/>'.'Level: '.$oneRow['LEVEL'].'<br/>'.'Color: '.$oneRow['COLOR']; } ?> One thing interests, how can you make it so that when you click on a picture, SELECT would work, but under a certain click. For example: There is a click on the picture with the name2 signature, SELECT is triggered, but it changes the WHERE NAME = "Name" to NAME = "Name2". Is it possible? If so, is it possible without JS?
I am not very good at programming, so my approach is probably not correct, if so, I will be grateful for any help :)
<a href='test.php?name=Name2'>and in php code, use this parameter from$_GET['name']and make a request to the database as here php.net/manual/ru/pdostatement.execute.php in example 2. If the page should not be overloaded then do about the same thing through ajax - Mike$sth=$dbo->prepare('select * from .... where NAME=? ...'); $sth->execute(array($_GET['name']));$sth=$dbo->prepare('select * from .... where NAME=? ...'); $sth->execute(array($_GET['name']));php.net/manual/ru/pdo.prepare.php - Mike 2:38 pm