Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $server = $_SERVER['SERVER_ADDR'];
- $username = 'root';
- $password = 'root';
- $dbname = 'web-base';
- $charset = 'utf8';
- $connection = new mysqli($server, $username, $password, $dbname);
- if($connection->connect_error){
- die("Ошибка соединения".$connection->connect_error);
- }
- if(!$connection->set_charset($charset)){
- echo "Ошибка установки кодировки UTF8";
- }
- ?>
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Тест</title>
- </head>
- <body>
- <form action="files.php" method="post" enctype="multipart/form-data">
- </form>
- <?php
- $id = $_GET[ 'id' ];
- $card = $_GET[ 'card' ];
- if ( !empty( $id && $card ))
- {
- if($card == '1'){
- if($id == '1'){
- $query = $connection->query("SELECT * FROM images where id = 1");
- while($row = $query->fetch_assoc()){
- $show_img = base64_encode($row['img']);?>
- <img src="data:image/jpeg;base64, <?=$show_img ?>" alt="">
- <?php }
- }
- if($id == '2'){
- $query = $connection->query("SELECT * FROM images where id = 2");
- while($row = $query->fetch_assoc()){
- $show_img = base64_encode($row['img']);?>
- <img src="data:image/jpeg;base64, <?=$show_img ?>" alt="">
- <?php }
- }
- }
- elseif($card == '2'){
- if($id == '1'){
- $query = $connection->query("SELECT * FROM images where id = 1");
- while($row = $query->fetch_assoc()){
- $show_img = base64_encode($row['img']);?>
- <img src="data:image/jpeg;base64, <?=$show_img ?>" alt="">
- <?php }
- }
- if($id == '2'){
- $query = $connection->query("SELECT * FROM images where id = 2");
- while($row = $query->fetch_assoc()){
- $show_img = base64_encode($row['img']);?>
- <img src="data:image/jpeg;base64, <?=$show_img ?>" alt="">
- <?php }
- }
- }
- }?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment