I have a MySQL query running on page that for some reason I sonly returning 1 row when run on my PHP application.
But when running the exact same query within PHP my admin it returns the correct number of rows.
This is the code I am using:
<?php
include ('includes/headFunctions.php');
include('includes/head.php');
?>
<div class="row container">
<?php
if(isset($_POST['weekly_search'])) {
$start_date = $_POST['start_date'];
$end_date = $_POST['end_date'];
$reporting = DB::getInstance()->query("SELECT * FROM transactions WHERE transaction_date BETWEEN '2015-08-01' AND '2015-08-17'");
if(!$reporting->count()) {
echo 'No results';
} else {
$_SESSION['weekly_records'] = 'true';
//if I run the foreach here it works correctly
}
}
$week_start_date = date("Y-m-d", strtotime('last Sunday'));
$week_end_date = date("Y-m-d");
//echo $start_date, '<br>';
//echo $end_date;
//die();
$results = DB::getInstance()->query("SELECT * FROM transactions WHERE transaction_date BETWEEN '$week_start_date' AND '$week_end_date'");
if ($results) {
$add = 0;
$minus = 0;
$total_transAdded = 0;
$total_transRedeemed = 0;
foreach ($results->results() as $result) {
$add = $total_transAdded += $result->transaction_add;
$minus = $total_transRedeemed += $result->transaction_redeem;
};
//print Elements
echo '<div class="row"><h1>Week Ending:</br> ', $week_end_date, '</h1></div>';
echo '<div class="row">';
echo '<div class="col-xs-6"><h2>Rewarded</h2>', '<h3>£', round ($add, 2), '</h3></div>';
echo '<div class="col-xs-6"><h2>Redeemed</h2></div>', '<h3>£', round ($minus, 2), '</h3></div>';
echo '</div>';
} else {
echo '<div class="error">No records found</div>';
} //end if search->data
?>
<div class="row">
<div class="col-lg-12">
<a class="btn btn-primary btn-lg" href="#" data-toggle="modal" data-target="#date_picker_modal">Search By Date</a>
</div>
</div>
</div> <!-- End row container -->
<!-- Report Generator Modal -->
<div class="modal fade" id="date_picker_modal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
<h4 class="modal-title" id="myModalLabel">Add Transaction</h4>
</div>
<div class="modal-body">
<form action="" method="post">
<div class="input-group">
<span class="input-group-addon">Start Date</span>
<input type="date" min='0001-01-01' max='9999-12-31' name="start_date" class="form-control" step="any" min="0" required>
</div>
<hr>
<div class="input-group">
<span class="input-group-addon">End Date</span>
<input type="date" min='0001-01-01' max='9999-12-31' name="end_date" class="form-control" step="any" min="0" required>
</div>
</div>
<div class="modal-footer">
<input type="hidden" name="token" value="<?php echo Token::generate(); ?>">
<button type="submit" name="weekly_search" class="btn btn-primary">Search</button>
</form>
</div>
</div>
</div>
</div>
<?php if(isset($_SESSION['weekly_records'])) {?>
<!-- Report Generator Modal -->
<div class="modal fade" id="weekly_records" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
<h4 class="modal-title" id="myModalLabel">Reports</h4>
</div>
<div class="modal-body">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Customer</th><th>Added</th><th>Redeemed</th><th>Date</th>
</tr>
</thead>
<tbody>
<?php
//running the foreacheach only retunrs the last result
foreach($reporting->results() as $report) {
echo '<tr>';
echo '<td>View</td>';
echo '<td>£', round($report->transaction_add, 2), '</td>';
echo '<td>£', round($report->transaction_redeem, 2), '</td>';
echo '<td>', $report->transaction_date, '</td>';
echo '</tr>';
}
?>
</tbody>
</table>
</div>
<div class="modal-footer">
<button class="btn btn-default" type="button" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<?php } ?>
<?php include 'includes/footer.php'; ?>
Try this:
foreach($reporting->results() as $report) {
echo '<tr>';
echo '<td>View</td>';
echo '<td>£', round($report->transaction_add, 2), '</td>';
echo '<td>£', round($report->transaction_redeem, 2), '</td>';
echo '<td>', $report->transaction_date, '</td>';
echo '</tr>';
}
Related
I have made a bootstrap modal for updating each record in the table individually using a while loop in PHP, but it seems to work only for the first record of the table. I'm not being able to figure out where I'm going wrong. Please help me with it let me know where I'm going wrong.
Here's the code:
<!DOCTYPE html>
<html>
<body>
<?php
$sql = "SELECT * FROM fee_status";
$result = $conn->query($sql);
$i = 1;
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
?>
<table>
<tr>
<td width='5%'><?php echo $i++; ?></td>
<td width='20%'><?php echo $row["student_id"]; ?><br><?php echo $row["student_name"]; ?></td>
<td width='10%'><?php echo $row["fee_due"]; ?></td>
<td width='25%'>
<div class="dropdown">
<button class='btn btn-primary dropdown-toggle' type='button' id='dropdownMenuButton' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>Actions</button>
<div class='dropdown-menu' aria-labelledby='dropdownMenuButton'>
<a class='dropdown-item' data-toggle='modal' data-target="#myModal<?php echo $row['student_id']; ?>">Update Payment</a>
</div>
</div>
</td>
</tr>
</table>
<div class="modal" role="dialog" id="myModal<?php echo $row['student_id']; ?>">
<div class="modal-dialog" role="document" style="max-width: 65%;">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Update Payment</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form id="update_payment_form" class="form-group" action="update_fee.php" method="post">
<div class='form-group required'>
<div class="row">
<div class="col-md-6">
Student Details: <input type="text" name="student_details" value='<?php echo $row['student_id']; ?> - <?php echo $row['student_name']; ?>' style='width: 70%;' readonly>
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
Amount: <input type="number" name="new_payment" placeholder='<?php echo $row['fee_due']; ?>' style='width: 40%;' required>
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
Date: <input id="date-field" type="date" name="date" style='width: 40%;'>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" onclick="form_submit()" class="btn btn-primary">Update</button>
</div>
</div>
</div>
</div>
<?php
}
}
?>
</body>
</html>
I'm very noob in PHP, but i'm really stuck here trying to figure out how to delete a row printed in a while loop here :
<?php
$sql5 = "SELECT * FROM user_exp WHERE id=".$_SESSION["ID"]."";
$result3 = mysqli_query($conn, $sql5);
if (mysqli_num_rows($result3) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result3)) {
echo "<h4>" . $row["exp_title"]. "<a href='#' title=''><i class='fa fa-pencil'></i><i onclick='location.href='userprofile.php?deleteID=".$row["auto_id"]."';' class='fa fa-minus-square' data-toggle='modal' data-target='#EXPDELModal' value='delete_exp'></i></a></h4>";
echo "<p>" . $row["exp_detail"]. "</p>";
}
}
else
{
echo "<div class='textfaded2'>Add you experience here.</div>";
}
?>
Note: i want to delete the row using a font-awesome icon and i'm using
'auto_id' as the auto_increment, primary key to define the row i want
to delete.
Here is the code for the modal:
<div class="modal fade" id="EXPDELModal" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Delete Experience</h4>
</div>
<div class="modal-body">
<h3>Are you sure?</h3>
<br>
<br>
</div>
<div class="modal-footer">
<form action="userprofile.php?deleteID=<?php '.$row["auto_id"].';?>"
style="width: 100%;" method="post" value="delete_exp">
<button type="button" name="delete" class="btn btn-default" data-
dismiss="modal">YES</button>
<button type="button" class="btn btn-default" data-
dismiss="modal">NO</button>
</form>
</div>
</div>
</div>
</div>
And finally the query for delete:
<?php
if(isset($_POST['delete']))
{
$sql6="DELETE FROM `user_exp` WHERE auto_id=".$_GET['deleteID']."";
$result=mysqli_query($conn,$sql6) or die();
}
?>
I would like to thank you for taking the time to read this.
<?php
$sql5 = "SELECT * FROM user_exp WHERE id=" . $_SESSION["ID"] . "";
$result3 = mysqli_query($conn, $sql5);
if (mysqli_num_rows($result3) > 0) {
while ($row = mysqli_fetch_assoc($result3)) {
?>
<h4><?php echo $row["exp_title"]; ?>
<a href='#' title=''>
<i class='fa fa-pencil'></i>
<i onclick='setValue("<?php $row["auto_id"]; ?>");' class='fa fa-minus-square' data-toggle='modal'
data-target='#EXPDELModal'></i>
</a>
</h4>
<p><?php echo $row["exp_detail"]; ?></p>;
<?php
}
} else {
echo "<div class='textfaded2'>Add you experience here.</div>";
}
if (isset($_POST['delete'])) {
if($_POST['deleteID']) {
$sql6 = "DELETE FROM `user_exp` WHERE auto_id=" . $_POST['deleteID'] . "";
$result = mysqli_query($conn, $sql6) or die();
}
}
?>
<script>
function setValue(value) {
document.getElementById("deleteId").value = value;
}
</script>
<div class="modal fade" id="EXPDELModal" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Delete Experience</h4>
</div>
<div class="modal-body">
<h3>Are you sure?</h3>
<br>
<br>
</div>
<div class="modal-footer">
<form action="userprofile.php" style="width: 100%;" method="post" name="delete_exp">
<input type="hidden" value="0" name="deleteID" id="deleteId" readonly/>
<button type="submit" name="delete" class="btn btn-default" data-dismiss="modal">YES</button>
<button type="button" class="btn btn-default" data-dismiss="modal">NO</button>
</form>
</div>
</div>
</div>
</div>
I have this table of data where I am going to get the id of each row and pass it to the modal and the modal will show the further details of the id. For now, when each row is clicked, the modal will pop up and show more of the details. I am also going to do the same with the edit, only have the values in an input type.
Here is the code for the table:
<?php
echo ''.$row[0].'';
$db = mysql_connect("localhost","root");
mysql_select_db("thesis");
$sql = "SELECT * FROM childinfo Order by lastName ASC";
$result = mysql_query($sql);
if(mysql_num_rows($result)>0)
{
while($row = mysql_fetch_row($result)){
if ($childID==$row[0]){
echo '<div class="p-3 mb-2 bg-info text-white text-center rounded"><h6>Childs Basic Information</label></h6></div><br>';
echo '<b>Full Name: </b>'.$row[1].', ' .$row[2]. ' '.$row[3].'<br>';
echo '<b>Gender: </b>'.$row[11].'<br>';
echo '<b>Birthday: </b>'.$row[5].'<br>';
echo '<b>Age: </b>'.$row[6].'<br>';
echo '<b>Name of Main Household: </b>'.$childID.'<br><br>';
echo '<div class="p-3 mb-2 bg-info text-white text-center rounded"><h6>Childs Health Information</label></h6></div><br>';
echo '<b>Height: </b> <input type="text" name="height" class="form-control" value="'.$row[8].'">';
echo '<b>Weight: </b><input type="text" name="weight" class="form-control" value="'.$row[7].'">';
echo '<b>BMI: </b><input type="text" name="bmi" class="form-control" value="'.$row[9].'">';
echo '<b>Date Weighed: </b><input type="date" name="dateWeighed" class="form-control" value="'.$row[13].'">';
echo '<b>Health History: </b><input type="text" name="healthHis" class="form-control" value="'.$row[12].'">';
}}}
?>
Here is the code for my modal:
<div class="modal fade" id="view" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Child Profile</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<?php
echo ''.$childID.'';
$db = mysql_connect("localhost","root");
mysql_select_db("thesis");
$sql = "SELECT * FROM childinfo Order by lastName ASC";
$result = mysql_query($sql);
if(mysql_num_rows($result)>0)
{
while($row = mysql_fetch_row($result)){
if ($childID==$row[0]){
echo '<div class="p-3 mb-2 bg-info text-white text-center rounded"><h6>Childs Basic Information</label></h6></div><br>';
echo '<b>Full Name: </b>'.$row[1].', ' .$row[2]. ' '.$row[3].'<br>';
echo '<b>Gender: </b>'.$row[11].'<br>';
echo '<b>Birthday: </b>'.$row[5].'<br>';
echo '<b>Age: </b>'.$row[6].'<br>';
echo '<b>Name of Main Household: </b>'.$childID.'<br><br>';
echo '<div class="p-3 mb-2 bg-info text-white text-center rounded"><h6>Childs Health Information</label></h6></div><br>';
echo '<b>Height: </b>'.$row[8].' cm <br>';
echo '<b>Weight: </b>'.$childID.' kg <br>';
echo '<b>BMI: </b>'.$row[9].'<br>';
echo '<b>Date Weighed: </b>'.$row[13].'<br>';
echo '<b>Health History: </b>'.$row[12].'<br>';
echo '<b>Health Status: </b>'.$row[10].'<br>';
}}}
?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
for now, it will only echo the id that is last in the table and only that id.
I have a view in my project(PHP codeigniter), where the user can confirm or remove a particular record from the table of data displayed. When the user chooses to confirm a record, a modal pop up box shows up reassuring the confirmation. Clicking on the Confirm button in this modal will call a controller method to update the DB table appropriately via a consequent model method call. The same applies to the remove functionality in the view. I have implemented and called all the respective methods but it doesn't seem to affect in any way.
Code in context
1.View
<body>
<div class="content" style="background-color: white">
<div class="container-fluid" style="overflow-y: auto">
<legend>Vacancies Applied</legend>
<div>
<form class="form-horizontal" id="viewVacancy">
<?php echo $this->session->flashdata('msgconfirmed');
echo $this->session->flashdata('msgremoved');?>
<table class="table" id="vacancyApplicationTable" >
<thead class="active">
<tr style="background-color: lightblue;color: white" >
<th class="hidden-lg hidden-lg">ID</th>
<th>Company</th>
<th>Job Title</th>
<th>Applied Date</th>
<th>Closing Date</th>
<th>Status</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody >
<?php
if(count($vacanciesApplied)>0) {
foreach ($vacanciesApplied as $row) { ?>
<tr>
<td class="hidden-lg hidden-lg"><a><?php echo $row->vid; ?></a></td>
<td><?php echo $row->onBehalfOf; ?></td>
<td><?php echo $row->jobTitle; ?></td>
<td><?php echo $row->appliedDate; ?></td>
<td><?php echo $row->closingDate; ?></td>
<?php
if ($row->status == "pending")
{
$status = "Pending";
?>
<td><?php echo $status ?></td>
<td></td>
<td><a data-toggle="modal" data-name="<?php echo $row->vid; ?>" data-id="<?php echo $row->studentId; ?>" title="Add this item" class="open-AddBookDialog btn btn-danger" href="#deleteVacancyApplication">Remove</a></td>
<?php
}
else
{
$status = "Accepted"; ?>
<td class="blink_text"><?php echo $status ?></td>
<td><a data-toggle="modal" data-name="<?php echo $row->vid; ?>" data-id="<?php echo $row->studentId; ?>" title="Add this item" class="open-AddBookDialog btn btn-info" href="#confirmVacancyStatus">Confirm</a></td>
<td><a data-toggle="modal" data-name="<?php echo $row->vid; ?>" data-id="<?php echo $row->studentId; ?>" title="Add this item" class="open-AddBookDialog btn btn-danger" href="#deleteVacancyApplication">Remove</a></td>
<?php
}
?>
</tr>
<?php }
}
?>
</tbody>
</table>
</form>
</div>
</div>
</div>
</body>
<script>
$(function () {
$('#vacancyApplicationTable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth":true
});
});
</script>
<script>
$(document).on("click", ".open-AddBookDialog", function () {
var studentId = $(this).data('id');
var vid = $(this).data('name');
$(".modal-body #uid").val( studentId );
$(".modal-body #vid").val( vid );
});
</script>
<!-- Modal for confirmVacancyStatus -->
<div class="modal fade" id="confirmVacancyStatus" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-keyboard="false" data-backdrop="false">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" style="background-color:lawngreen">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 id="uid"><i class="glyphicon glyphicon-check"></i> Confirm</h4>
</div>
<div class="modal-body">
<form method="post" id="formConfirm" action="<?php echo base_url() . 'index.php/studentDashboardController/confirmVacancy'?>">
<input type="text" name="vid" id="vid" value="" hidden/>
<div class="form-group">
<p>You got Accepted to follow this vacancy</p>
<p>Do you confirm this?</p>
</div>
</form>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success pull-right">Confirm</button>
</div>
</div>
</div>
</div>
<!-- Modal for deleteVacancyApplication -->
<div class="modal fade" id="deleteVacancyApplication" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-keyboard="false" data-backdrop="false">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" style="background-color:red">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 id="uid"><i class="glyphicon glyphicon-remove"></i> Cancel</h4>
</div>
<div class="modal-body">
<form method="post" id="form" action="<?php echo base_url() . "index.php/studentDashboardController/deleteVacancyRequest"?>">
<input type="text" name="vid" id="vid" value="" hidden/>
<div class="form-group">
<p>Are you sure you want to cancel your application for this vacancy</p>
</div>
</form>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-danger pull-right">Cancel Application</button>
</div>
</div>
</div>
</div>
2.Controller- studentDashboardController/confirmVacancy
public function confirmVacancy()
{
if (isset($this->session->userdata['logged_in']))
{
$uid = ($this->session->userdata['logged_in']['userId']);
$data['notifyCount']= $this->notifications->getUnreadNotification($uid);
$data['title']= $this->notifications->getUnreadNotificationTitle($uid);
$data['notifyCount']= $this->notifications->getUnreadNotification($uid);
$data['users'] = $this->user->getUserNames();
$msg = $this->vacancyModel->confirmVacancyApplication($uid,$this->input->post());
$msgText = $msg['msg'];
$msgType = $msg['type'];
//Loading View
if($msgType == "danger")
{
$this->session->set_flashdata('msgconfirmed', '<div class="alert alert-danger text-center">'.$msgText.'</div>');
}
else
{
$this->session->set_flashdata('msgconfirmed', '<div class="alert alert-success text-center">'.$msgText.'</div>');
}
redirect(base_url('index.php/studentDashboardController/displayVacanciesApplied'));
}
else
{
$this->load->view('login/loginView');
}
}
3.Model- vacancyModel->confirmVacancyApplication
public function confirmVacancyApplication($uid, $post)
{
$vid = $post['vid'];
$data = array(
'availability' => $vid+""
);
$this->db->where("uid", $uid);
$status = $this->db->update("studentprofile", $data);
if($status)
{
$msg = "You have successfully confirmed";
$type = "success";
$msgData = array(
'msg' => $msg,
'type' => $type
);
return $msgData;
}
else
{
$msg = "Sorry. This vacancy could not be confirmed";
$type = "danger";
$msgData = array(
'msg' => $msg,
'type' => $type
);
return $msgData;
}
}
Interfaces
Any suggestions in this regard will be highly appreciated.
You are closing the before submit button.
Put form after input type="submit" tag. It will work
In my search input give me result about keywords like below:
![While of result's] http://i.stack.imgur.com/7VaWl.png
and my target is get more information by open Modal if click any result:
http://i.stack.imgur.com/qU36A.png
I want to select more information from mysql on open model. How can I do this?
Below is my code:
<body>
<h1>חפש פריט</h1>
<br>
<form action="search.php" method="post">
<input type="text" name="keywords" class="form-control" style="width: 250px;margin-left:auto;margin-right:auto;display:inline;" placeholder="הקלד שם של פריט..." /><button type="submit" name="search" class="btn btn-primary">חפש</button>
</form>
<br>
<?php
$keywords = $_POST['keywords'];
$ok = 1;
if(isset($_POST['search'])) {
if(empty($keywords)) {
echo '<div class="alert alert-danger fade in">
×
<strong>שגיאה:</strong> הקלד מילות חיפוש
</div>';
$ok = 0;
}
if(!empty($keywords) && !preg_match("/[A-Za-z0-9א-ת\.\,\_\- ]/", $keywords)) {
echo '<div class="alert alert-danger fade in">
×
<strong>שגיאה:</strong> הזנת תווים לא חוקיים
</div>';
$ok = 0;
}
else if($ok !== 0) {
$search_sql = mysql_query("SELECT * FROM `list` WHERE `Name` LIKE '%$keywords%';");
if(mysql_num_rows($search_sql) < 1) {
$status = "
<div class='alert alert-warning'>
<strong>לא מצאנו</strong> תוצאות עבור חיפוש זה ($keywords)
</div>
";
}
echo '<div class="container">
<h2>תוצאות חיפוש</h2>
<br />
'.$status.'';
while($result = mysql_fetch_array($search_sql)) {
printf('
<div class="well" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">%s</div><br />
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
', $result['Name']);
}
echo '</div>';
}
}
?>
EDIT: Now I am can select the information form the mysql but only with while of "$i"..
with this:
echo '<div class="container">
<h2>תוצאות חיפוש</h2>
<br />
'.$status.'';
$i = 1;
while($result = mysql_fetch_array($search_sql) and $i < 1000) {
printf('
<div class="well" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal'.$i.'">%s</div><br />
<div id="myModal'.$i.'" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">'.$result['Name'].'</h4>
</div>
<div class="modal-body">
<p>'.$result["Description"].'</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">סגור</button> <span style="float:left;">'.$result["Date"].'</span>
</div>
</div>
</div>
</div>
', $result['Name']);
}
But, it is not working good. If I'm click on any-result the modal is open with same result:
i.stack.imgur.com/SKrka.png
So, I want anything more proffesional for this..
Does not matter,
I am just replace the i var to result-id from the mysql
Replace this:
<div class="well" class="btn btn-info btn-lg" data-toggle="modal" data-target="#openM'.$i.'">%s</div><br />
<div id="openM'.$i.'" class="modal fade" role="dialog">
To:
<div class="well" class="btn btn-info btn-lg" data-toggle="modal" data-target="#openM'.$result['ID'].'">%s</div><br />
<div id="openM'.$result['ID'].'" class="modal fade" role="dialog">
Have a nice day! ☺