Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Datenbankwert im modalen Rahmen anzeigen zeigt nur den ersten Datensatz an

$sql_data="SELECT * FROM $tbl_name_data ORDER BY date ASC";
$result_data=mysql_query($sql_data);
<?php
while($rows_data=mysql_fetch_array($result_data)){
?>
<a href='#' class='basic' id="m_<?php echo $rows_data['id'];?>">
<font>
<b><? echo $rows_data['Date']; ?></b> : 
<br />
<? echo $rows_data['Titel']; ?>
</font>
</a>
<br />
<div id="basic-modal-content_<?php echo $rows_data['id'];?>">
<h3><? echo $rows_data['Titel']; ?></h3>
<p><? echo $rows_data['Description']; ?></p>
</div>
<?php
}
?>

Skript

$(".basic").click(function(){
 var id = $(this).attr("id");
  var id1 = id.split("_");
   $("#"+id1[1]).modal('show');
});