CodingStudent Posted August 19, 2020 Share Posted August 19, 2020 (edited) Hi friends, i want to ask a question. i have two page: "slider.php" and "mansethaberler.php" i extract two data from the database, named "addnews_headline" and "addnews_image" in slider.php. i create link to extracted "headline" from the database. See i added first image. when i clicked the link, link is heading to the second page "mansethaberler.php" and in "mansethaberler.php" with "SELECT" i extract from database "headline" and "image". Now i want to do that. When i clicked the link in "slider.php" i want to listing the image and headline in "mansethaberler.php". "mansethaberler.php" <?php $veri = $db->query("SELECT * FROM haberlerekle ORDER BY haberekle_id",PDO::FETCH_ASSOC)->fetchAll(); ?> <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12"> <?php foreach ($veri as $haber) { ?> <div style="border:1px solid black; height:50px; background-color:#17a2b8; color:white; line-height:50px; text-align:center;"><?php echo $haber["habereklesayfasi_baslik"]; ?></div> <div class="row no-gutters"> <img class="col-lg-12 mt-2" src="upload/images/<?php echo $haber["haberekle_resim"]; ?>" style="max-height:444px;"> </div> </div> <div class="col-lg-12 ml-auto mt-1 mb-1" style="padding-left:7px;"><?php echo $haber["haberekle_konu"]; } ?></div> "slider.php" <img src="upload/images/<?php echo $row["haberekle_resim"]; ?>" width="832" height="502"> <!-- upload/images/ ile <?php ?> tag'leri arasında boşluk olursa link kırılıyor. Resim çıkmıyor. --> <div class="carousel-caption"> <p><a href="mansethaberler.php"><?php echo $row['haberekle_baslik']; ?></a></p> </div> Edited August 19, 2020 by CodingStudent i forgot to put the most important codes Quote Link to comment https://forums.phpfreaks.com/topic/311349-how-can-i-listing-by-link/ Share on other sites More sharing options...
requinix Posted August 19, 2020 Share Posted August 19, 2020 11 minutes ago, CodingStudent said: When i clicked the link in "slider.php" i want to listing the image and headline in "mansethaberler.php". What problem are you having trying to do that? Isn't that the same thing that slider.php is already doing? Just copy that. Quote Link to comment https://forums.phpfreaks.com/topic/311349-how-can-i-listing-by-link/#findComment-1580768 Share on other sites More sharing options...
CodingStudent Posted August 19, 2020 Author Share Posted August 19, 2020 Sorry, i forgot to writing that. i can extract "image" and "headline" to the database, but it extract all "images" and "headlines". I did that. "SELECT * FROM haberlerekle ORDER BY haberekle_id LIMIT 1" this time, it is getting one data, but i saved data first. it doesn't i clicked. Quote Link to comment https://forums.phpfreaks.com/topic/311349-how-can-i-listing-by-link/#findComment-1580770 Share on other sites More sharing options...
requinix Posted August 19, 2020 Share Posted August 19, 2020 Do you want mansethaberler.php to show only one headline? According to the link you clicked? Or to show all of them but show the one from the link first (and the user can see others)? Quote Link to comment https://forums.phpfreaks.com/topic/311349-how-can-i-listing-by-link/#findComment-1580772 Share on other sites More sharing options...
CodingStudent Posted August 19, 2020 Author Share Posted August 19, 2020 "slider.php" all page <?php $veriler = $db->query("SELECT * FROM haberlerekle ORDER BY haberekle_id DESC LIMIT 12",PDO::FETCH_ASSOC)->fetchAll(); ?> <div id="demo" class="carousel slide" data-ride="carousel"> <ul class="carousel-indicators"> <?php $i = 0; foreach ($veriler as $row) { $actives = ''; if($i == 0) { $actives = 'active'; } ?> <li data-target="#demo" data-slide-to="<?php echo $i; ?>" class="<?php echo $actives; ?>"></li> <?php $i++; } ?> </ul> <div class="carousel-inner"> <?php $i = 0; foreach ($veriler as $row) { $actives = ''; if($i == 0) { $actives = 'active'; } ?> <div class="carousel-item <?php echo $actives; ?>"> <img src="upload/images/<?php echo $row["haberekle_resim"]; ?>" width="832" height="502"> <!-- upload/images/ ile <?php ?> tag'leri arasında boşluk olursa link kırılıyor. Resim çıkmıyor. --> <div class="carousel-caption"> <p><a href="mansethaberler.php"><?php echo $row['haberekle_baslik']; ?></a></p> </div> </div> <?php $i++; } ?> </div> <a class="carousel-control-prev" href="#demo" data-slide="prev"> <span class="carousel-control-prev-icon"></span> </a> <a class="carousel-control-next" href="#demo" data-slide="next"> <span class="carousel-control-next-icon"></span> </a> </div> "mansethaberler.php" all page <?php include "header.php"; ?> <?php $db = new PDO("mysql:host=localhost; dbname=boz_der; charset=utf8", "user", "ltmD38wbx"); ?> <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12 telefon-margin-top-slide"> <?php include "solmenu.php"; ?> </div> <?php $veri = $db->query("SELECT * FROM haberlerekle ORDER BY haberekle_id",PDO::FETCH_ASSOC)->fetchAll(); ?> <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12"> <?php foreach ($veri as $haber) { ?> <div style="border:1px solid black; height:50px; background-color:#17a2b8; color:white; line-height:50px; text-align:center;"><?php echo $haber["habereklesayfasi_baslik"]; ?></div> <div class="row no-gutters"> <img class="col-lg-12 mt-2" src="upload/images/<?php echo $haber["haberekle_resim"]; ?>" style="max-height:444px;"> </div> </div> <div class="col-lg-12 ml-auto mt-1 mb-1" style="padding-left:7px;"><?php echo $haber["haberekle_konu"]; } ?></div> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 mt-2 mb-1"> <?php include "footer.php"; ?> </div> Before i post from admin.php, first image and i extract from database in "slider.php", second image and i want to getting page "mansethaberler.php", third page Quote Link to comment https://forums.phpfreaks.com/topic/311349-how-can-i-listing-by-link/#findComment-1580774 Share on other sites More sharing options...
requinix Posted August 20, 2020 Share Posted August 20, 2020 I don't yet understand what you want mansethaberler.php to do. You need to describe what the page is supposed show. I know that slider.php has a link and that you are clicking the link to go to mansethaberler.php, but I don't know what you want that page to do. Quote Link to comment https://forums.phpfreaks.com/topic/311349-how-can-i-listing-by-link/#findComment-1580775 Share on other sites More sharing options...
CodingStudent Posted August 20, 2020 Author Share Posted August 20, 2020 the image and link different i clicked in "slider.php" the image and link that displayed is different. i want to display in "mansethaberler.php" i clicked image and link. Quote Link to comment https://forums.phpfreaks.com/topic/311349-how-can-i-listing-by-link/#findComment-1580792 Share on other sites More sharing options...
CodingStudent Posted August 20, 2020 Author Share Posted August 20, 2020 i clicked link and image this ---> in "mansethaberler.php" is shows ---> both are different images. When i clicked the link, same image must display , not second image. Quote Link to comment https://forums.phpfreaks.com/topic/311349-how-can-i-listing-by-link/#findComment-1580796 Share on other sites More sharing options...
requinix Posted August 20, 2020 Share Posted August 20, 2020 slider.php: SELECT * FROM haberlerekle ORDER BY haberekle_id DESC LIMIT 12 mansethaberler.php: SELECT * FROM haberlerekle ORDER BY haberekle_id Quote Link to comment https://forums.phpfreaks.com/topic/311349-how-can-i-listing-by-link/#findComment-1580810 Share on other sites More sharing options...
CodingStudent Posted August 20, 2020 Author Share Posted August 20, 2020 eventually, i did it. mansethaberler.php <?php include "header.php"; ?> <?php $db = new PDO("mysql:host=localhost; dbname=boz_der; charset=utf8", "user", "ltmD38wbx"); ?> <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12 telefon-margin-top-slide"> <?php include "solmenu.php"; ?> </div> <?php if($_GET) { $verial = $_GET["git"]; ?> <?php $veri = $db->query("SELECT * FROM haberlerekle WHERE haberekle_id='$verial'"); ?> <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12"> <?php foreach ($veri as $haber) { ?> <div style="border:1px solid black; height:50px; background-color:#17a2b8; color:white; line-height:50px; text-align:center;"><?php echo $haber["habereklesayfasi_baslik"]; ?></div> <div class="row no-gutters"> <img class="col-lg-12 mt-2" src="upload/images/<?php echo $haber["haberekle_resim"]; ?>" style="max-height:444px;"> </div> </div> <div class="col-lg-12 ml-auto mt-1 mb-1" style="padding-left:7px;"><?php echo $haber["haberekle_konu"]; } ?></div> <?php } ?> slider.php <?php $veriler = $db->query("SELECT * FROM haberlerekle ORDER BY haberekle_id DESC LIMIT 12",PDO::FETCH_ASSOC)->fetchAll(); ?> <div id="demo" class="carousel slide" data-ride="carousel"> <ul class="carousel-indicators"> <?php $i = 0; foreach ($veriler as $row) { $actives = ''; if($i == 0) { $actives = 'active'; } ?> <li data-target="#demo" data-slide-to="<?php echo $i; ?>" class="<?php echo $actives; ?>"></li> <?php $i++; } ?> </ul> <div class="carousel-inner"> <?php $i = 0; foreach ($veriler as $row) { $actives = ''; if($i == 0) { $actives = 'active'; } ?> <?php $idcek = $row["haberekle_id"]; ?> <div class="carousel-item <?php echo $actives; ?>"> <img src="upload/images/<?php echo $row["haberekle_resim"]; ?>" width="832" height="502"> <!-- upload/images/ ile <?php ?> tag'leri arasında boşluk olursa link kırılıyor. Resim çıkmıyor. --> <div class="carousel-caption"> <p><a href="mansethaberler.php?git=<?php echo $idcek; ?>"><?php echo $row['haberekle_baslik']; ?></a></p> </div> </div> <?php $i++; } ?> </div> <a class="carousel-control-prev" href="#demo" data-slide="prev"> <span class="carousel-control-prev-icon"></span> </a> <a class="carousel-control-next" href="#demo" data-slide="next"> <span class="carousel-control-next-icon"></span> </a> </div> i added that codes in mansethaberler.php <?php if($_GET) { $verial = $_GET["git"]; ?> and if this part <?php $veri = $db->query("SELECT * FROM haberlerekle WHERE haberekle_id='$verial'"); ?> ='$verial' i added that codes in slider.php <?php $idcek = $row["haberekle_id"]; ?> and if this part <p><a href="mansethaberler.php?git=<?php echo $idcek; ?>"><?php echo $row['haberekle_baslik']; ?></a></p> <a href="mansethaberler.php?git=<?php echo $idcek; ?>"> and anymore if i click which link, it is showing the other page. Thank you everything. Quote Link to comment https://forums.phpfreaks.com/topic/311349-how-can-i-listing-by-link/#findComment-1580815 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.