Ich arbeite mit Bootstrap
Modell und html table
mit Details Schaltfläche in while loop
. Das aktuelle Szenario zeigt nur Daten in Tabelle mit abgerufenen Daten aus der Datenbank. Bildschirm geschossen Bootstrap Modell in PHP während Schleife Datenausgabe
ich nur Bootstrep Modell mit Details Schaltfläche implementieren, wenn ich in dieser Liste auf eine beliebige Taste klicken Sie einfach nur die erste Eingabe von Daten angezeigt wird. Wenn ich zum Beispiel auf die dritte Schaltfläche klicke, zeigt das Modell die ersten Daten für die Eingabe der Schaltfläche an.
Dies ist mein Code
<?php
include_once("..\connection.php");
if(isset($_GET['q'])){
$q = ($_GET['q']);
$sql="SELECT * FROM propertytable WHERE property_name like '%".$q."%' OR property_desc like '%".$q."%' OR property_type like '%".$q."%' OR property_sub_type like '%".$q."%' OR property_service like '%".$q."%' OR propert_location like '%".$q."%'";
$result = mysqli_query($conn,$sql);
}else
{
$type = ($_GET['type']);
$sub_Type = ($_GET['subType']);
$property_service = ($_GET['propertyService']);
$property_location = ($_GET['propertyLocation']);
$start_Prize = ($_GET['startPrize']);
$end_Prize = ($_GET['endPrize']);
//echo $property_service; exit;
include_once("..\connection.php");
$sql="SELECT * FROM propertytable WHERE property_name like '%".$type."%' OR property_sub_type like '%".$sub_Type."%'";
if($property_service !="" && $property_service!="Select Property Service")
$sql.=" AND property_service like '%".$property_service."%'";
if($property_location!="")
$sql.=" AND property_location like '%".$property_location."%'";
if($start_Prize!="" AND $end_Prize!="")
$sql.= " AND property_prize between '".$start_Prize."' AND '".$end_Prize."' ";
$result = mysqli_query($conn,$sql);
}
echo "<br>";
echo "<div class='container'>";
echo "<table border='0' align='center' cellspacing='10' id='mytable'>";
$i=1;
while($row = mysqli_fetch_array($result)) {
echo "<tr><td><img src='..\\".$row['image_front']."' style='width:150px; height:150px; vertical-align: text-top'></td>
<td valign='top'><span style='font-weight:bold; margin-top:10cm '>Name: </span>".$row['property_name']."<br /><br />
<span style='font-weight:bold; '>Description: </span>".$row['property_desc']."<br /><br />
<span style='font-weight:bold; '>Property Type: </span>".$row['property_type']."<br /><br />
<span style='font-weight:bold; '>Property Sub Type: </span>".$row['property_sub_type']."<br /><br />
<div style='float: right; text-align: right; width: 50%;'>
<button type='button' class='btn btn-primary btn-lg' data-toggle='modal' data-target='#myModal' id='modelbutton'>
Details
</button>
</div>
<div class='modal fade' id='myModal".$i."' tabindex='-1' role='dialog' aria-labelledby='myModalLabel'>
<div class='modal-dialog' role='document'>
<div class='modal-content'>
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>×</span></button>
<h4 class='modal-title' id='myModalLabel'> Property Details</h4>
</div>
<div class='modal-body'>
<div id='myCarousel' class='carousel slide' data-ride='carousel'>
<ol class='carousel-indicators'>
<li data-target='#myCarousel' data-slide-to='0' class='active'></li>
<li data-target='#myCarousel' data-slide-to='1'></li>
<li data-target='#myCarousel' data-slide-to='2'></li>
</ol>
<div class='carousel-inner' role='listbox'>
<div class='item'>
<img src='..\\".$row['image_front']."' alt='property_front'>
</div>
<div class='item'>
<img src='..\\".$row['image_side']."'
alt='property_side'>
</div>
<div class='item active'>
<img src='..\\".$row['image_back']."'
alt='property_back'>
</div>
</div>
</div>
<a class='left carousel-control' href='#myCarousel' role='button' data-slide='prev'>
<span class='glyphicon glyphicon-chevron-left' aria-hidden='true'></span>
<span class='sr-only'>Previous</span>
</a>
<a class='right carousel-control' href='#myCarousel' role='button' data-slide='next'>
<span class='glyphicon glyphicon-chevron-right' aria-hidden='true'></span>
<span class='sr-only'>Next</span>
</a>
</div>
<span style='font-weight:bold; '>Property Service: </span>".$row['property_name']."<br /><br />
<span style='font-weight:bold; '>Property Size: </span>".$row['property_size']."<br /><br />
<span style='font-weight:bold; '>Property Location: </span>".$row['propert_location']."<br />
<div class='modal-footer'>
<button type='button' class='btn btn-default' data-dismiss='modal'>Close</button>
</div>
</div>
</div>
</div>";
$i++;
}
echo "</table>";
mysqli_close($conn);
?>
Bitte jede mögliche Weise vorschlagen, dies zu tun.
wenn Klick auf den Button die ID dieser Zeile übergeben und auf der Grundlage der ID den Datensatz aus databse Ajax und Last in Modell erhalten mit .. –
Sie mit Echo Ihre Fragen versucht haben? finden Sie, dass Daten in Abfragen richtig gesetzt sind oder nicht? – Bhavin
Ich weiß nicht, wie ID übergeben werden, weil ich kein ID-Feld in 'Datenbank' habe. Bitte geben Sie ein Beispiel, wie man das macht. – viratpuar