
samuel_lopez
Members-
Posts
47 -
Joined
-
Last visited
samuel_lopez's Achievements

Member (2/5)
0
Reputation
-
Display Distinct data with each related data
samuel_lopez replied to samuel_lopez's topic in PHP Coding Help
Hi @Barand, I used your Method 2 code. Thanks for helping me. Your code works perfect. I have last 1 problem, I want to classify all the products like the example below.How can I make this using your code (method 2). I have added classification field in the table. Thank you BRAND CATEGORY Class A Class B brand A school supply pencil paper food meat meatballs Brand X food milk purified water Juice lemonade -
Display Distinct data with each related data
samuel_lopez replied to samuel_lopez's topic in PHP Coding Help
I have displayed the result in the table but still duplicate Brand and duplicate Category is displayed. I want to display my data without the data with striked through. BRAND CATEGORY PRODUCTS brand A school supply pencil brand A school supply paper Brand A food meat Brand X food milk Brand X food water Brand X Juice lemonad I applied the code of stefany93. Thank you @stefany93 -
Display Distinct data with each related data
samuel_lopez replied to samuel_lopez's topic in PHP Coding Help
Hi @Barand,I have stored my results into 2 dimensional array. how can I display the result into my desired table(table display.jpg). this is my code <?php $sql = $mysqli->query("Select brand,category,product from tblproducts"); while($row=mysqli_fetch_array($sql)) { $list[] = $row; } echo '<pre>'; print_r($list) ; ?> THank you. -
Display Distinct data with each related data
samuel_lopez replied to samuel_lopez's topic in PHP Coding Help
Hi Barand. Thanks for your reply. I will apply your solution. Will update you once done. -
Hi everyone, I have a problem displaying data into table. I want to display my query into table using php mysql.(please refer to image attached named table display.jpg) My code is: <table class="tableviewreport" align="center"> <thead> <tr> <th>BRAND</th> <th>CATEGORY</th> <th>PRODUCTS</th> </tr> </thead> <tbody> <?php $sqlbrand = $mysqli->query("Select DISTINCT brand from tblproducts"); while ($rowbrand = mysqli_fetch_array($sqlbrand)) { $brand = $rowbrand['brand']; echo "<tr>"; echo "<td>" . $brand . "</td>"; //display all distinct brand $sqlcategory = $mysqli->query("Select DISTINCT category from tblproducts where brand = '".$brand."'"); echo "<td>"; while ($rowcateg = mysqli_fetch_array($sqlcategory)) { $category = $rowcateg['category']; echo $category . "<br>";//display category of each brands } $sqlproduct = $mysqli->query("Select DISTINCT product from tblproducts where brand = '".$brand."' and category = '".$category."'"); while ($rowprod = mysqli_fetch_array($sqlproduct)) { $product = $rowprod['product']; echo "<td>" . $product . "<td>"; } echo "</td>"; echo "</tr>"; } ?> </tbody> </table> but this code displays (wrong display.jpg)
-
Hi all, I have a problem in my projects. I have uploaded my two projects in xampp. My problem is once I logged out in PROJECT A, the current user that is logged-in in PROJECT B is also logged out.Please help me.Thank you.
-
How to automatic pop up an alert when time is 12 pm using javascript.
-
You should group your query by name
-
Hi to to all. Good day. I have a problem regarding passing function value to designated textbox when button is clicked This is my code in looping button and text box. <?php for($i=0;$i<5;$i++) {?> <div> <input type="text" name="timervalue" id="timers" value="" class="responseTime"> <input type="submit" name="itstimer[<?php echo $i; ?>]" value="Start" id="start"/> </div> <?php }; ?> //function startTimer = function(elemeto) { time=0; setInterval((function() { if(flagger ==true) { time++; } count = time; document.getElementById(elemeto).value = count; // $('#timers').val(count); }), 1000); // document.getElementById('start').hidden = true; }; //jquery to execute $('input[type=submit]').on('click', function(e) { if($(this).val() == 'Start') { name = $(this).attr('name'); timer = name.match(/\[(.*)\]/)[1]; timerField = $('input[name="timervalue['+timer+']"]'); timerField = 'timers'; return startTimer(timerField); } }); }); </script> The problem is that, when i click the 2nd button, the value passed in textbox 1. I want that when I click 2nd button, value will pass to 2nd textbox, when I click the first button, then it will pass value to first textbox, and so on. Please see attached file. Thank you
-
Hi Psycho. THank you. Your code works like a charm
-
Hi Ch0cu3r. THis is my code to output. I used Php while ($row = $res->fetch_assoc()): ?> <tr> <td><?php echo strtoupper($row['project']); ?></td> <td><?php echo strtoupper($row['status']); ?></td> <td><?php echo strtoupper($row['counter']); ?></td> </tr> <?php endwhile; ?>
-
Hi I have a query that look like this SELECT Count(tbltesttransactions.Trans_ID) as Passed ,tbltesttransactions.Status_ID as status ,tbltesttransactions.projectid as project FROM tbltesttransactions WHERE tbltesttransactions.Status_ID = '1' UNION SELECT Count(tbltesttransactions.Trans_ID) as Failed ,tbltesttransactions.Status_ID as status ,tbltesttransactions.projectid as project FROM tbltesttransactions WHERE tbltesttransactions.Status_ID = '2' But its output is like below: counter status project 5 Passed project1 2 Failed project1 1 Passed project2 3 Failed project2 I want my output like this: Project Passed Failed project1 5 2 project2 1 3 Please help me Your help is much appreciated.
-
Hi to all. How can I retain select box value after submit this is my current code <?php $query = $mysqli->query("Select Proj_ID as id, PROJECT_NAME as project from tblproject"); ?> <select name="project" class="required" id="selproject"> <option disabled selected>Select Project</option> <?php while($option = $query->fetch_object()){ ?> <option value="<?php echo $option->id; ?>"><?php echo $option->project; ?></option> <?php } ?> </select> Thank you
-
HI All, I have a problem on how to confirm page redirection.. How can I pop up a message that will confirm user when he want to go to another page of my website. I used this code, but it's always pops up message even when user save any data. I want only specific links to be affected by this code. Please help me. <script language="JavaScript" type="text/javascript"> window.onbeforeunload = function(){ return 'Are you sure you want to leave?'; }; </script> THank you
-
Hi to all. How can I retain select box value after submit this is my current code <?php $query = $mysqli->query("Select Proj_ID as id, PROJECT_NAME as project from tblproject"); ?> <select name="project" class="required" id="selproject"> <option disabled selected>Select Project</option> <?php while($option = $query->fetch_object()){ ?> <option value="<?php echo $option->id; ?>"><?php echo $option->project; ?></option> <?php } ?> </select> Thank you