Php and jquery Dynamic to show and hide div - php

I have a list of the conditions and i fetch their name and it works fine but i want when i click the condition name it description come below.
i have done that but it shows for only one can you help me for that
Here is html code which i use for showing the description of the record it always shows the last record.
when i add the record it add means works fine for adding
it also works fine for edit also for the delete
but if there is two record then every time it show the description of last record not on which i click
I want to show the description of the record which is clciked
Thanks
<div>
<?php
$query="select * from tbl_coditions where userId=".$_SESSION['userId'];
$result=mysql_query($query) or die(mysql_error());
while($row=mysql_fetch_array($result))
{
$VisitDate=strtotime($row['DiagnosisDate']);
$VisitDate=date("m-d-Y",$VisitDate);
$userId=$row['userid'];
$conditionId=$row['conditionId'];
?>
<script>
$(document).ready(function(){
$("a#p<?php if(isset($conditionId)) echo $conditionId; ?>").click(function(event){
$("#HiddenDiv<?php if(isset($conditionId)) echo $conditionId; ?>").show();
})
});
</script>
<div id="AjaxDiv1">
<div id="HiddenDiv<?php if(isset($conditionId)) echo $conditionId?>" style="display:none;">
<?php
$query="select * from tbl_coditions where conditionId=$conditionId";
$result=mysql_query($query) or die(mysql_error());
$query_result=mysql_fetch_array($result);
$VisitDate=strtotime($query_result['DiagnosisDate']);
$VisitDate=date("m-d-Y",$VisitDate);
?>
<div class="detailContainer panelContent">
<div class="panelTitle" tabindex="-1">
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_Name_Row_RowContainer" class="detailRowContainer">
<div class="detailRow">
<div class="detailLeftColumn mxDetailsLabel"> Condition:
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_Name_Row_ValidatorContainer" class="detailErrorContainer"></div>
</div>
<div class="detailRightColumn"> <span id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_Name_Row_ViewControl"><?php echo $query_result['ServiceName']; ?></span> </div>
</div>
</div>
</div>
<div class="detailContent">
<div class="narrowTopContent">
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_DiagnosisDate_Row_RowContainer" class="detailRowContainer detailRowOdd">
<div class="detailRow">
<div class="detailLeftColumn mxDetailsLabel"> Diagnosis Date:
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_DiagnosisDate_Row_ValidatorContainer" class="detailErrorContainer"></div>
</div>
<div class="detailRightColumn"> <span id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_DiagnosisDate_Row_ViewControl"><?php echo $VisitDate; ?></span> </div>
</div>
</div>
<div>
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_InnerUpdatePanel">
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_DateOfServiceSelection_Row_RowContainer" class="detailRowContainer">
<div class="detailRow">
<div class="detailLeftColumn mxDetailsLabel"> Date of Service:
<div class="detailErrorContainer"></div>
</div>
<div class="detailRightColumn">
<?php
$VisitDate=strtotime($query_result['DateofService']);
echo $VisitDate=date("m-d-Y",$VisitDate);
?>
</div>
</div>
</div>
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_InformationSource_RowContainer" class="detailRowContainer detailRowOdd">
<div class="detailRow">
<label>
<div class="detailLeftColumn mxDetailsLabel"> Information Source:
<div class="detailErrorContainer"></div>
</div>
<div class="detailRightColumn"> <span id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_InformationSource_SourceNameLabel">User Entered</span> </div>
</label>
</div>
</div>
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_DiagnosingProvider_Row_RowContainer" class="detailRowContainer">
<div class="detailRow">
<div class="detailLeftColumn mxDetailsLabel"> Provider or Facility:
<div class="detailErrorContainer"></div>
</div>
<div class="detailRightColumn"> <span><?php echo $query_result['Provider']; ?></span> </div>
</div>
</div>
<div class="notesSection">
<div class="commentRow">
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_Comment_Row_RowContainer" class="detailRowContainer">
<div class="detailRow">
<div class="detailLeftColumn mxDetailsLabel"> Notes:
<div class="detailErrorContainer"></div>
</div>
<div class="detailRightColumn"> <span><?php echo $query_result['Notes'] ?></span> </div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="YesNoSection">
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_IsShared_YesNoRow_RowContainer">
<div class="detailRow">
<fieldset>
<legend class="detailLeftColumn mxDetailsLabel"> <span>Hide this item when printing or when sharing with a health care provider?</span> </legend>
<div style="clear:both;"></div>
<div class="detailRightFieldsetColumn">
<div style="display: block; margin-top: 2px;"> <span class="detailRightColumn">
<div class="detailRightColumn">
<div><?php echo $query_result['HideItem'];?></div>
</div>
</span> </div>
</div>
</fieldset>
</div>
</div>
<div>
<div class="detailRow">
<fieldset>
<legend class="detailLeftColumn mxDetailsLabel"> <span>Do you still have this condition?</span> </legend>
<div style="clear:both;"></div>
<div class="detailRightFieldsetColumn">
<div style="display: block; margin-top: 2px;"> <span class="detailRightColumn">
<div class="detailRightColumn">
<div><?php echo $query_result['stillCondition'];?></div>
</div>
</span> </div>
</div>
<div class="detailErrorContainer"> </div>
<span class="question_mark"></span>
</fieldset>
</div>
</div>
</div>
</div>
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_ctl01">
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_EntryRightSideContainer" class="EntryRightSideContainer">
<div class="LearnMoreDetail">
<div class="mxRoundTable">
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_LearnMore_Container_headerDiv" class="mxRoundTableTitle">
<div class="mxRoundedCap"></div>
</div>
<div class="mxDataTableBackground">
<div class="mxRoundedCap">
<div class="mxRoundedMain">
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_LearnMore_Container_titleDiv" class="mxDataTableTitle">
<h2>
<div class="LearnMoreDetailTitle">
<h2>Learn More About Diabetes Mellitus</h2>
</div>
</h2>
</div>
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_LearnMore_Container_ContentDiv" class="mxDataTableContent">
<div class="LearnMoreDetailText">
<ul>
<li>
<div id="learnMoreItem"> <img id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_LearnMore_Container_LinkRepeater_ctl00_Icon" src="images/content.png" alt="" style="border-width: 0px;"> <a id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_LearnMore_Container_LinkRepeater_ctl00_Link" href="javascript:PopupMultiViewer('/common/content/contentviewer.aspx%3fcui=C0011849%26topic=Diabetes+Mellitus%26etype=%26subtypes=%26contid=XIe3090mJjlQCAfxu90R%26toplink=%26topid=0%26topsrcid=0')">Articles related to Diabetes Mellitus</a>
<div style="clear: both;"></div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="mxRoundTableFooter">
<div class="mxRoundedCap"></div>
</div>
</div>
</div>
</div>
<div class="Pan" style="width: 650px; display: none; position: fixed; z-index: 100001; left: 631.5px; top: 447.5px;">
<div class="mxModalContainer" id="ModalContainer">
<div class="mxHeader">
<div>
<div class="mxModalContentTitle">
<h1></h1>
</div>
</div>
<div class="mxModalContentTitleClose"> </div>
<div>
<div class="mxModalContentTitleAdditional"> </div>
</div>
</div>
</div>
</div>
<div class="modalBackground" style="display: none; position: fixed; left: 0px; top: 0px; z-index: 10000; width: 1263px; height: 994px;" id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_ctl05_ModalDialogExtender_backgroundElement"></div>
</div>
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_CommandRow_DetailButtonRow" class="detailRow detailButtonRow">
<div id="ctl00_ctl00_ctl00_Content_LobbyContent_Content_EntryRepeater_ctl00_InterfaceControl_DetailAnimator_ctl03_CommandRow_DetailButtonContainer"><script type="text/javascript">
jQuery(document).ready(function(){
$("#button").click( function(){
var optionValue = <?php echo $conditionId ?>;
var categoryval=1;
jQuery.ajax({
type: "GET",
url: "getcondition.php",
data: "category="+optionValue+"&categoryval="+categoryval,
success: function(response){
jQuery("#AjaxDiv").html(response);
jQuery("#AjaxDiv").show();
jQuery("#AjaxDiv1").hide();
}
});
});
});
</script>
<div class="mxButtonOrange"> <span>
<button class="mxClearButtonOrange" id="button" type="button" name="button">Edit</button>
</span> </div>
<div class="mxButtonOrange"> <span>
<script type="text/javascript">
jQuery(document).ready(function(){
$("#button1").click( function(){
var optionValue = <?php echo $conditionId ?>;
var categoryval=1;
jQuery.ajax({
type: "GET",
url: "deletecondition.php",
data: "category="+optionValue+"&categoryval="+categoryval,
success: function(response){
jQuery("#AjaxDiv").html(response);
jQuery("#AjaxDiv").show();
jQuery("#AjaxDiv1").hide();
}
});
});
});
</script>
<button class="mxClearButtonOrange" type="button" id="button1" value="Delete" >Delete</button>
</span> </div>
</div>
</div>
</div>
</div>
</div>`enter code here`

Related

I cannot make php to replace a <p> text by my $_SESSION['userlogged'] value

I have tried
<?php session_start(); ?>
.
.
.
<p><?php $_SESSION['loggeduser']; ?>;</p>
I have also tried this JS after the
<script type="text/javascript">
let vuser = '<%= session.getAttribute("loggeduser") %>';
document.getElementById("userid").value= "Not set";
</script>
If someone can tell me what am I doing wrong please!
This is my full body code:
<body>
<section id="MyHeader" style="border:solid red thin;">
<div id="TheHead" style="width:80%; display:inline-block;">
<div id="HeadImg" style="width: 100px; height:100px;">
<a href="main.html">
<img src="../images/icon-redcross.png" alt="AGR">
</a>
</div>
<div id="HeadLegend">
<div id="AGRbrand"><h1>AGR</h1></div>
<div id="quote">
<span style="font-size: small;"><i>Properties catalogue</i></span>
</div>
</div>
</div>
<div id="user" style="display:inline-block; width:12%; height:25px;">
<p id="userid" style="width:100%;"><?php $_SESSION['loggeduser'];?></p>
<script type="text/javascript">
let vuser = '<%= session.getAttribute("loggeduser") %>';
document.getElementById("userid").value= "Not set";
</script>
</div>
<div style="width:100%; display:block;">
<div id="MenuButtons" style="width:80%; display:flex; justify-content:right;">
<div id="newbtn" class="TopButton">New</div>
<div id="exitbtn" class="TopButton">Exit</div>
</div>
</div>
<div class="Subtitle">
<div style="display: flex; justify-content: left; width:100%;">
<h4>Properties</h4>
</div>
</div>
</section>
<div id="Estates" class="pagebreak"></div>
<section id="MyPage">
<div id="Home"></div>
<div class="page" style="width:100%; background-color: white; ">
<div style="display: flex; justify-content:center; width:100%;">
<div class="ServiceBox">
<div class="div-img">
<img src="../../images/house-B.png" alt="AGR">
</div>
<div class="div-info">
</div>
<div class="div-desc">
</div>
<div class="div-btns">
<a class="SideButton" href="Edit.html">Edit</a>
<a class="SideButton" href="Delete.html">Delete</a>
<a class="SideButton" href="pdf-file.html">Pdf</a>
</div>
</div>
</div>
</div>
</section>
</body>
Notes: $_SESSION["loggeduser"] is populated before this page,at the login page; I verified the variable was properly set by a log file I have, and I was able to see the value printed in the log, after the user logs in and before this page is loaded.
Not sure if it is the php version or the goDaddy servers, but in my case the problem was, I was using html extension for the files, I changed them to .php extension and the php code started to work.

JQuery get siblings value / text in dynamically created element

I want to get the .text() of the sibling customerID from the class"db_record_left" when class="db_record_left" gets clicked.
The whole class="db_record" is dynamical generated. But the console.log(CustID); still prints it for every class="db_record" and not only for the clicked one.
echo'
<div class="db_record" id="potentialCustomer-'.$countPotentialCustomers.'">
<div class="db_record_left">
<div class="db_record_describer">'.$cus_Fname.' '.$cus_Lname.'</div>
<div class="db_record_info_wrapper">
<div class="db_record_info_describer">Adresse:</div>
<div class="db_record_info">'.$cus_Adress.'</div>
<div class="db_record_info">
<span>'.$cus_ZipCode.' </span>
<span>'.$cus_Locality.'</span>
</div>
</div>
<div class="db_record_info_wrapper">
<div class="db_record_info_describer">Fahrzeuge:</div>
'.matchVehicles($cus_Vehicles).'
</div>
</div>
<div class="db_record_right">
<div class="material-icons md-large md-ghost-white-enabeld w-embed">
<span class="material-icons-outlined">navigate_next</span>
</div>
</div>
</div>
<span class="customerID" style="display: none">'.$cus_ID.'</span>
';
This would be the jQuery-code
function checkCustomerInformation(){
$(".db_records_wrapper").on('click', 'div.db_record', function (){
const CustID = $(this).siblings(".customerID").text();
console.log(CustID);
});
}
siblings() gets every matching sibling element. To get only the only following the .db_record which was clicked, use next():
$(this).next(".customerID").text();
Here's a working example:
function checkCustomerInformation() {
$(".db_records_wrapper").on('click', 'div.db_record', function() {
const custID = $(this).next(".customerID").text();
console.log(custID );
});
}
checkCustomerInformation();
.db_record {
margin: 10px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<div class="db_records_wrapper">
<div class="db_record" id="potentialCustomer-'.$countPotentialCustomers.'">
<div class="db_record_left">
<div class="db_record_describer">$cus_Fname1 $cus_Lname1</div>
<div class="db_record_info_wrapper">
<div class="db_record_info_describer">Adresse:</div>
<div class="db_record_info">$cus_Adress1</div>
<div class="db_record_info">
<span>$cus_ZipCode1</span>
<span>$cus_Locality1</span>
</div>
</div>
<div class="db_record_info_wrapper">
<div class="db_record_info_describer">Fahrzeuge:</div>
matchVehicles($cus_Vehicles1)
</div>
</div>
<div class="db_record_right">
<div class="material-icons md-large md-ghost-white-enabeld w-embed">
<span class="material-icons-outlined">navigate_next</span>
</div>
</div>
</div>
<span class="customerID" style="display: none">$cus_ID1</span>
<div class="db_record" id="potentialCustomer-'.$countPotentialCustomers.'">
<div class="db_record_left">
<div class="db_record_describer">$cus_Fname2 $cus_Lname2</div>
<div class="db_record_info_wrapper">
<div class="db_record_info_describer">Adresse:</div>
<div class="db_record_info">$cus_Adress2</div>
<div class="db_record_info">
<span>$cus_ZipCode2</span>
<span>$cus_Locality2</span>
</div>
</div>
<div class="db_record_info_wrapper">
<div class="db_record_info_describer">Fahrzeuge:</div>
matchVehicles($cus_Vehicles2)
</div>
</div>
<div class="db_record_right">
<div class="material-icons md-large md-ghost-white-enabeld w-embed">
<span class="material-icons-outlined">navigate_next</span>
</div>
</div>
</div>
<span class="customerID" style="display: none">$cus_ID2</span>
</div>

Why is Semantic-Ui Popup not Functioning?

I am working on a Laravel project. I included a SemanticUI popup but it doesn't work and I get a javascript error:
Popup: The target or popup you specified does not exist on the page
I used a view for the popup code called popup.blade.php and I included it in my Laravel index page.
Popup:
<div class="ui fluid popup bottom left transition hidden" style="top: 551.634px; left: 0.994324px; bottom: auto; right: auto; width: 614.659px;">
<div class="ui four column relaxed divided grid">
<div class="column">
<h4 class="ui header">Fabrics</h4>
<div class="ui link list">
<a class="item">Cashmere</a>
<a class="item">Linen</a>
<a class="item">Cotton</a>
<a class="item">Viscose</a>
</div>
</div>
</div>
JavaScript:
$(document).ready(function() {
$('.grid-cell').popup({
inline: true,
hoverable: true,
popup: '.special.popup',
position: 'bottom left',
delay: {
show: 300,
hide: 800
}
});
});
Index:
<div class="grid-calendar">
<div class="row calendar-week-header">
<div class="col-xs-1 grid-cell">
<div>
<div><span class="hd">Monday</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span class="hd">Tuesday</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span class="hd">Wednesday</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span class="hd">Thursday</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span class="hd">Friday</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span class="hd">Saturday</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span class="hd">Sunday</span></div>
</div>
</div>
</div>
<div class="row calendar-week">
<div class="col-xs-1 grid-cell">
<div>
<div><span></span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span></span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span></span></div>
</div>
</div>
<div class="col-xs-1 grid-cell " style="background-color: #dddada;">
<div>
<div><span>1</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>2</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>3</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>4</span></div>
</div>
</div>
</div>
<div class="row calendar-week">
<div class="col-xs-1 grid-cell">
<div>
<div><span>5</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>6</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>7</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>8</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>9</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>10</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>11</span></div>
</div>
</div>
</div>
<div class="row calendar-week">
<div class="col-xs-1 grid-cell">
<div>
<div><span>12</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>13</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>14</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>15</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>16</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>17</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>18</span></div>
</div>
</div>
</div>
<div class="row calendar-week">
<div class="col-xs-1 grid-cell">
<div>
<div><span>19</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>20</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>21</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>22</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>23</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>24</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>25</span></div>
</div>
</div>
</div>
<div class="row calendar-week">
<div class="col-xs-1 grid-cell">
<div>
<div><span>26</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>27</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>28</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>29</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>30</span></div>
</div>
</div>
<div class="col-xs-1 grid-cell">
<div>
<div><span>31</span></div>
</div>
</div><span></span></div>
</div>

SAMP PHP API Integration

I want to show the number of players in the server instead of that UNKNOWN thing, I haven't enabled the API yet, can I get help that, I want to integrate the progress bar to the total players in game like
if players are 50/100
= 50% of the bar will be filled.
Like the bar should work as the api updates.
<div class="is-clearfix"></div>
<section class="section dark-grey has-text-centered">
<div class="container">
<div class="heading">
<h1 class="title">Our Servers</h1>
<br>
</div>
<div class="columns is-gapless">
<div class="column">
<div class="card card-server">
<div class="card-image">
<figure class="image is-2by1">
<img src="./OutBreak Gaming_files/sfcnr_card1.png">
</figure></div> <div class="card-content">
<div class="title" style="font-size: 1.25em; color: rgb(119, 119, 119); margin-top: 0.5em;">87.98.241.207:7775</div>
<div class="players is-marginless">
<div class="content playersOnline">
Unknown PLAYERS ONLINE
</div>
<progress value="0" max="100" class="progress is-success"></progress>
<br></div> <a class="button is-info is-medium is-fullwidth">Play Now</a>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
Just use the SACNR monitor API, and
<div class="columns is-gapless">
<div class="column"><div class="card card-server">
<div class="card-image">
<figure class="image is-2by1">
<img src="./OutBreak Gaming_files/sfcnr_card1.png"></figure></div>
<div class="card-content">
<div class="title" style="font-size: 1.25em; color: rgb(119, 119, 119); margin-top: 0.5em;">87.98.241.207:7775</div> Hostname:
<div class="hosting"></div>Gamemode:
<div class="game-mode"></div>Map:
<div class="language"></div> Players:
<div class="players is-marginless"><div class="content playersOnline">
FETCHING PLAYERS ONLINE
</div>
<progress value="0" max="100" class="progress is-success"></progress><br></div>
<a class="button is-info is-medium is-fullwidth">Play Now</a></div></div></div></div></div></section></div>
Where We fetch from API the following things
<?php
require_once("sampsvr.php");
$monitor = new SACNR\Monitor;
//$obj = $monitor->get_info_by_id(1790345);
$obj = $monitor->get_info_by_ip('87.98.241.207','7775');
$players = $obj->Players;
$hostName = $obj->Hostname;
$Gamemode = $obj->Gamemode;
$Mapname = $obj ->Language;
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.progress').val(<?php echo $players;?>);
$('.playersOnline').html(<?php echo $players;?> +' PLAYERS ONLINE' );
$('.hosting').html("<?php echo $hostName;?>");
$('.game-mode').html("<?php echo $Gamemode;?>");
$('.language').html("<?php echo $Mapname;?>");
});
</script>
You may find the API at http://monitor.sacnr.com/api.html

Making Photo Grid with Different size images

Ok, may be its really simple. but, I can't figure it out how to do it. What I want is to query one table and show results in two divs on the page. What I mean is that I have some html like this:
<div class="row">
<div class="small">
//
</div>
<div class="large">
//
</div>
<div class="small">
//
</div>
<div class="small">
//
</div>
<div class="small">
//
</div>
<div class="large">
//
</div>
</div>
and the query like this
$stmt = $pdo->prepare("SELECT * FROM cars WHERE cars_cat = ? ORDER BY car_id DESC");
$stmt->execute(array($cat_id));
$data = $stmt->fetchAll();
foreach($data as $row) {
}
The database table is simple table with id, name, image, cars_cat.
UPDATE:
This is the structure of the gallery
<div class="col-sm-4 col-md-4 col-lg-4 nopadding"> <!-- First Column -->
<div class="small">
</div>
<div class="large">
</div>
<div class="small">
</div>
<div class="small">
</div>
</div> <!-- End First Column -->
<div class="col-sm-4 col-md-4 col-lg-4 nopadding"> <!-- Second Column -->
<div class="small">
</div>
<div class="small">
</div>
<div class="large">
</div>
<div class="small">
</div>
</div> <!-- End Second Column -->
<div class="col-sm-4 col-md-4 col-lg-4 nopadding"> <!-- Third Column -->
<div class="large">
</div>
<div class="small">
</div>
<div class="large">
//
</div>
</div> <!-- End Third Column -->
Try this way
<style>
.row {
-webkit-column-width:400px;
-moz-column-width:400px;
column-width:400px;
-webkit-column-gap:5px;
-moz-column-gap:5px;
column-gap:5px;
}
.small-box{
display:inline-block;
margin:0 0 5px 0;
padding:10px;
color:white;
}
.img-responsive{
width:100%;
height:auto;
}
</style>
<div class="row">
<div class="small-box">
<img src="http://aneemals.com/wp-content/uploads/2013/04/photos-of-animals-that-know-what-love-is-3.jpg" alt="img" class="img-responsive">
</div>
<div class="small-box">
<img src="http://www.softstuffcreations.com/refresh/data/zoom_image/1772-PandaBear_resized.jpg" alt="img" class="img-responsive">
</div>
<div class="small-box">
<img src="http://images6.fanpop.com/image/photos/35600000/wild-animals-animals-of-the-world-35665506-800-533.jpg" alt="img" class="img-responsive">
</div>
<div class="small-box">
<img src="http://nice-animals.com/wp-content/uploads/2013/10/facts-of-love-between-animals-08.jpg" alt="img" class="img-responsive">
</div>
<div class="small-box">
<img src="http://www.kenya.com/wp-content/uploads/2013/03/Mt-Kenya-Animals.jpg" alt="img" class="img-responsive">
</div>
<div class="small-box">
<img src="http://www.softstuffcreations.com/refresh/data/zoom_image/1772-PandaBear_resized.jpg" alt="img" class="img-responsive">
</div>
<div class="small-box">
<img src="http://fc09.deviantart.net/fs71/i/2012/364/4/3/animals___lion_9_by_moonsongstock-d5pr9za.jpg" alt="img" class="img-responsive">
</div>
</div>
Means basically what you need to update is to update code this way
<div class="row">
<?php
foreach($data as $row) {
echo '<div class="small-box"> your image </div>';
}
?>
</div>
<div class="row">
<?php
foreach($data as $row) {
if($row->div_type == 0){
echo '<div class="small"> your data </div>';
}else{
echo '<div class="large"> your data </div>';
}
}
?>
</div>

Categories