Şimdi Ara

Varsayılan php ile mySQL Tabloları birleştirme yardım

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
2 Misafir (1 Mobil) - 1 Masaüstü1 Mobil
5 sn
1
Cevap
0
Favori
445
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • Elimde böyle bir çıktı var ve ben burada roomidleri aynı olan alanları birleştirmek ve photoname olan alanda virgül ile ayırmak istiyorum yardımcı olurmusunuz? Önceki php kodları verdim ardından ekran çıktısı bulunmaktadır. Not: site linklerini xxx olarak yaptım bilginize.

    <?php 
    error_reporting(E_ALL); ini_set("display_errors", 1);

    include ('config/config.php');

    //sql query
    $pagessql = "SELECT page_id AS page_json_id,page_title_short,page_title_full, CONCAT ('http://www.xxx.com/cms/core/uploads/page_banners_large/',page_banner_large_name) AS banner_link,content,page_sort_order,gallery_id FROM pages WHERE page_id IN (3,2,4,5,6,7,30) AND page_status = 1 ORDER BY page_sort_order ASC";
    $pageroomsql = "SELECT R.room_id AS room_json_id,R.room_name,P.photo_title,R.room_size ,R.bed_size,R.room_booking_link,R.room_content, CONCAT ('http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/', P.photo_name) AS photo_link FROM rooms R, room_photos P WHERE R.room_id = P.room_id ORDER BY R.room_sort_order DESC, R.room_name ASC";
    //$pageroomsql = "SELECT room_id,GROUP_CONCAT(DISTINCT room_id) FROM room_photos GROUP BY photo_id ORDER BY GROUP_CONCAT(DISTINCT room_id) ASC";
    //"SELECT p.product_model FROM products p INNER JOIN products_attributes as pa ON (p.product_id = pa.product_id) WHERE pa.options_values_id = 134"
    //$pageroomsql = "SELECT room_id,GROUP_CONCAT(photo_name) FROM room_photos GROUP BY room_id";
    $pagesrestaurantsql = "SELECT F.facility_id AS facility_json_id,P.photo_id,F.facility_name,F.faci lity_banner_large_name,F.facility_content,P.photo_ title, CONCAT ('http://www.xxx.com/cms/plugins/facilities/uploads/facility_photos_large/', P.photo_name) AS photo_link FROM facilities F,facility_photos P WHERE F.facility_id = P.facility_id AND facility_status = 1 AND facility_type = 'rest' ORDER BY facility_sort_order DESC, facility_name ASC";
    $pagesbarssql = "SELECT F.facility_id AS facility_json_id,P.photo_id,F.facility_name,F.faci lity_banner_large_name,F.facility_content,P.photo_ title, CONCAT ('http://www.xxx.com/cms/plugins/facilities/uploads/facility_photos_large/', P.photo_name) AS photo_link FROM facilities F,facility_photos P WHERE F.facility_id = P.facility_id AND facility_status = 1 AND facility_type = 'bar' ORDER BY facility_sort_order DESC, facility_name ASC";
    $pagesactivitiessql = "SELECT F.facility_id AS facility_json_id,P.photo_id,F.facility_name,F.faci lity_banner_large_name,F.facility_content,P.photo_ title, CONCAT ('http://www.xxx.com/cms/plugins/facilities/uploads/facility_photos_large/', P.photo_name) AS photo_link FROM facilities F,facility_photos P WHERE F.facility_id = P.facility_id AND facility_status = 1 AND facility_type = 'act' ORDER BY facility_sort_order DESC, facility_name ASC";
    $pagespagallerysql = "SELECT photo_id AS photo_json_id,gallery_id,photo_title, CONCAT ('http://www.xxx.com/cms/plugins/photo_galleries/uploads/gallery_large/', photo_name) AS photo_link FROM gallery_photos WHERE gallery_id IN (130)";
    $pageroomgallerysql = "SELECT photo_id AS photo_json_id,gallery_id,photo_title, CONCAT ('http://www.xxx.com/cms/plugins/photo_galleries/uploads/gallery_large/', photo_name) AS photo_link FROM gallery_photos WHERE gallery_id IN (135)";
    $pagerestaurantgallerysql = "SELECT photo_id AS photo_json_id,gallery_id,photo_title, CONCAT ('http://www.xxx.com/cms/plugins/photo_galleries/uploads/gallery_large/', photo_name) AS photo_link FROM gallery_photos WHERE gallery_id IN (133)";
    $pagepoolgallerysql = "SELECT photo_id AS photo_json_id,gallery_id,photo_title, CONCAT ('http://www.xxx.com/cms/plugins/photo_galleries/uploads/gallery_large/', photo_name) AS photo_link FROM gallery_photos WHERE gallery_id IN (132)";
    $pagehotelgallerysql = "SELECT photo_id AS photo_json_id,gallery_id,photo_title, CONCAT ('http://www.xxx.com/cms/plugins/photo_galleries/uploads/gallery_large/', photo_name) AS photo_link FROM gallery_photos WHERE gallery_id IN (131)";
    $pagebarsgallerysql = "SELECT photo_id AS photo_json_id,gallery_id,photo_title, CONCAT ('http://www.xxx.com/cms/plugins/photo_galleries/uploads/gallery_large/', photo_name) AS photo_link FROM gallery_photos WHERE gallery_id IN (134)";
    $pagesresult = mysql_query($pagessql,$con);
    $pageroomresult = mysql_query($pageroomsql,$con);
    $pagesrestaurantresult = mysql_query($pagesrestaurantsql,$con);
    $pagesbarsresult = mysql_query($pagesbarssql,$con);
    $pagesactivitiesresult = mysql_query($pagesactivitiessql,$con);
    $pagespagalleryresult = mysql_query($pagespagallerysql,$con);
    $pageroomgalleryresult = mysql_query($pageroomgallerysql,$con);
    $pagerestaurantgalleryresult = mysql_query($pagerestaurantgallerysql,$con);
    $pagepoolgalleryresult = mysql_query($pagepoolgallerysql,$con);
    $pagehotelgalleryresult = mysql_query($pagehotelgallerysql,$con);
    $pagebarsgalleryresult = mysql_query($pagebarsgallerysql,$con);
    $pagesjson = array();
    $pageroomjson = array();
    $pagesrestaurantjson = array();
    $pagesbarsjson = array();
    $pagesactivitiesjson = array();
    $pagespagalleryjson = array();
    $pageroomgalleryjson = array();
    $pagerestaurantgalleryjson = array();
    $pagepoolgalleryjson = array();
    $pagehotelgalleryjson = array();
    $pagebarsgalleryjson = array();

    if (mysql_error())
    {
    echo ("MySQL hatası oluştu. Hata: ");
    echo mysql_error() ;
    }
    //menu pages
    if(mysql_num_rows($pagesresult)){
    while($pagesrow = mysql_fetch_array($pagesresult)){
    $pagesjson['pagemenu'][] = array('pageid' => $pagesrow['page_json_id'],'pagetitle' => $pagesrow['page_title_short'],'pagefulltitle' => $pagesrow['page_title_full'], 'pagesbannerpath' => $pagesrow['banner_link'], 'content' => $pagesrow['content'], 'pagesorder' => $pagesrow['page_sort_order']);
    }
    }
    //room pages
    if(mysql_num_rows($pageroomresult)){
    while($pageroomrow = mysql_fetch_array($pageroomresult)){
    $pageroomjson['pageroom'][] = array('roomid' => $pageroomrow['room_json_id'],'roomsize' => $pageroomrow['room_size'], 'bedsize' => $pageroomrow['bed_size'], 'roombooking' => $pageroomrow['room_booking_link'], 'roomcontent' => $pageroomrow['room_content'], 'phototitle' => $pageroomrow['photo_title'], 'photolink' => $pageroomrow['photo_link']);
    }
    }
    //restaurant pages
    if(mysql_num_rows($pagesrestaurantresult)){
    while($pagesrestaurantrow = mysql_fetch_array($pagesrestaurantresult)){
    $pagerestaurantjson['pagerestaurant'][] = array('restaurantid' => $pagesrestaurantrow['facility_json_id'],'restaurantname' => $pagesrestaurantrow['facility_name'], 'restaurantcontent' => $pagesrestaurantrow['facility_content'],'phototitle' => $pagesrestaurantrow['photo_title'], 'photoid' => $pagesrestaurantrow['photo_id'], 'restaurantbanner' => $pagesrestaurantrow['facility_banner_large_name'], 'photolink' => $pagesrestaurantrow['photo_link']);
    }
    }
    //bars pages
    if(mysql_num_rows($pagesbarsresult)){
    while($pagesbarsrow = mysql_fetch_assoc($pagesbarsresult)){
    $pagesbarsjson['pages_bars'][] = $pagesbarsrow;
    }
    }
    //activities pages
    if(mysql_num_rows($pagesactivitiesresult)){
    while($pagesactivitiesrow = mysql_fetch_assoc($pagesactivitiesresult)){
    $pagesactivitiesjson['pages_activities'][] = $pagesactivitiesrow;
    }
    }
    //page spa gallery
    if(mysql_num_rows($pagespagalleryresult)){
    while($pagespagalleryrow = mysql_fetch_assoc($pagespagalleryresult)){
    $pagespagalleryjson['page_spa_gallery'][] = $pagespagalleryrow;
    }
    }
    //page room gallery
    if(mysql_num_rows($pageroomgalleryresult)){
    while($pageroomgalleryrow = mysql_fetch_assoc($pageroomgalleryresult)){
    $pageroomgalleryjson['page_room_gallery'][] = $pageroomgalleryrow;
    }
    }
    //page restaurant gallery
    if(mysql_num_rows($pagerestaurantgalleryresult)){
    while($pagerestaurantgalleryrow = mysql_fetch_assoc($pagerestaurantgalleryresult)){
    $pagerestaurantgalleryjson['page_restaurant_gallery'][] = $pagerestaurantgalleryrow;
    }
    }
    //page pool gallery
    if(mysql_num_rows($pagepoolgalleryresult)){
    while($pagepoolgalleryrow = mysql_fetch_assoc($pagepoolgalleryresult)){
    $pagepoolgalleryjson['page_pool_gallery'][] = $pagepoolgalleryrow;
    }
    }
    //page hotel gallery
    if(mysql_num_rows($pagehotelgalleryresult)){
    while($pagehotelgalleryrow = mysql_fetch_assoc($pagehotelgalleryresult)){
    $pagehotelgalleryjson['page_hotel_gallery'][] = $pagehotelgalleryrow;
    }
    }
    //page bars gallery
    if(mysql_num_rows($pagebarsgalleryresult)){
    while($pagebarsgalleryrow = mysql_fetch_assoc($pagebarsgalleryresult)){
    $pagebarsgalleryjson['page_bars_gallery'][] = $pagebarsgalleryrow;
    }
    }
    echo strip_tags(json_encode($pagesjson + $pageroomjson + $pagesrestaurantjson + $pagesbarsjson + $pagesactivitiesjson + $pagespagalleryjson + $pageroomgalleryjson + $pagerestaurantgalleryjson + $pagepoolgalleryjson + $pagehotelgalleryjson + $pagebarsgalleryjson));
    mysql_close($con);
    ?>


    Ekran Çıktısı:

    pageroom: [
    {
    roomid: "21",
    roomsize: "36 m2",
    bedsize: "Double / Twin Bed and 1 Sofa",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/211381665811OW525a8c13ba1ed.jpg"
    },
    {
    roomid: "21",
    roomsize: "36 m2",
    bedsize: "Double / Twin Bed and 1 Sofa",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/211381665853XW525a8c3d2c88a.jpg"
    },
    {
    roomid: "21",
    roomsize: "36 m2",
    bedsize: "Double / Twin Bed and 1 Sofa",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/211381665553QW525a8b11c4644.jpg"
    },
    {
    roomid: "21",
    roomsize: "36 m2",
    bedsize: "Double / Twin Bed and 1 Sofa",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/211381665603UW525a8b43044ba.jpg"
    },
    {
    roomid: "21",
    roomsize: "36 m2",
    bedsize: "Double / Twin Bed and 1 Sofa",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/211381665633PW525a8b61d4676.jpg"
    },
    {
    roomid: "21",
    roomsize: "36 m2",
    bedsize: "Double / Twin Bed and 1 Sofa",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/211381665687XW525a8b9783d06.jpg"
    },
    {
    roomid: "25",
    roomsize: "36 m2",
    bedsize: "Double Bed or Twin Bed",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/251385288636MW5291d3bc40d88.jpg"
    },
    {
    roomid: "25",
    roomsize: "36 m2",
    bedsize: "Double Bed or Twin Bed",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/251385288120KW5291d1b869801.jpg"
    },
    {
    roomid: "25",
    roomsize: "36 m2",
    bedsize: "Double Bed or Twin Bed",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/251385288165CW5291d1e564e43.jpg"
    },
    {
    roomid: "27",
    roomsize: "64 m2",
    bedsize: "In the first room 1 double bed, In the other room one sofa which can be a bed for two people.",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/271381677154JW525ab862189c4.jpg"
    },
    {
    roomid: "27",
    roomsize: "64 m2",
    bedsize: "In the first room 1 double bed, In the other room one sofa which can be a bed for two people.",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/271381677177GW525ab879b6908.jpg"
    },
    {
    roomid: "27",
    roomsize: "64 m2",
    bedsize: "In the first room 1 double bed, In the other room one sofa which can be a bed for two people.",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/271381677237KW525ab8b52df87.jpg"
    },
    {
    roomid: "27",
    roomsize: "64 m2",
    bedsize: "In the first room 1 double bed, In the other room one sofa which can be a bed for two people.",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/271381677299GW525ab8f33d796.jpg"
    },
    {
    roomid: "27",
    roomsize: "64 m2",
    bedsize: "In the first room 1 double bed, In the other room one sofa which can be a bed for two people.",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/271381677359DW525ab92f5e205.jpg"
    },
    {
    roomid: "30",
    roomsize: "64 m2",
    bedsize: "In the first room 1 double bed, In the other room 2 Single Beds",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/301385289005MW5291d52d37f60.jpg"
    },
    {
    roomid: "30",
    roomsize: "64 m2",
    bedsize: "In the first room 1 double bed, In the other room 2 Single Beds",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/301385288981LW5291d515c4479.jpg"
    },
    {
    roomid: "30",
    roomsize: "64 m2",
    bedsize: "In the first room 1 double bed, In the other room 2 Single Beds",
    roombooking: "",
    roomcontent: "The Sentido Side is a resort within a resort for those seeking a more discerning experience and is an excellent choice for couples, groups of friends and single occupancy. If you are looking for serenity and comfort then the Sentido Lykia Resort is for you. Guests staying at the Residence can keep fit at the Credo Fitness Centre, chill out at the adults-only Blue Lagoon, take a peaceful break at the Quiet Room or relax with a soothing outdoor massage. ",
    phototitle: "Untitled Photo",
    photolink: "http://www.xxx.com/cms/plugins/rooms/uploads/room_photos_large/301385289029EW5291d545642e6.jpg"
    }
    ],







  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.