Jump to content

samuel_lopez

Members
  • Posts

    47
  • Joined

  • Last visited

Everything posted by samuel_lopez

  1. 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
  2. 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
  3. 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.
  4. Hi Barand. Thanks for your reply. I will apply your solution. Will update you once done.
  5. 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)
  6. 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.
  7. How to automatic pop up an alert when time is 12 pm using javascript.
  8. You should group your query by name
  9. 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
  10. Hi Psycho. THank you. Your code works like a charm
  11. 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; ?>
  12. 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.
  13. 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
  14. 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
  15. 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
  16. Hi to all, Thank you for your suggestion and help. Will now apply this fix. Thanks again.
  17. hi. I have a problem on importing csv file using php. Below code is working but its inserting the first line(header). I don't need to import also headers.How can I prevent the code to save headers. Your response is much appreciated.Thank you <?php include 'config.php'; if(isset($_POST["import"])){ echo $filename=$_FILES["file"]["tmp_name"]; if($_FILES["file"]["size"] > 0) { $file = fopen($filename, "r"); while (($emapData = fgetcsv($file, 10000, ",")) !== FALSE) { $sql = $mysqli->query("INSERT INTO table (name,age) VALUES ('$emapData[1]','$emapData[2]')") or die(mysqli_error($mysqli)); if(!$sql) { echo "<script type=\"text/javascript\"> alert(\"Invalid File:Please Upload CSV File.\"); window.location = \"import_student.php\" </script>"; } } fclose($file); echo "<script type=\"text/javascript\"> alert(\"CSV File has been successfully Imported.\"); window.location = \"import_student.php\" </script>"; mysqli_close($mysqli); } } ?>
  18. Hi to all Anyone here has a script on how to archive mysql database using php? Thank you.
  19. Hi all, i have a problem on how to pass sweet alert prompt value to another textbox. Please refer to https://limonte.github.io/sweetalert2/. this is my code remarksField = $('input[name="remarks['+testcase+']"]'); filenameField = $('input[name="filename['+testcase+']"]'); //enteredRemark = prompt('Enter your remarks', remarksField.val()); swal({ title: 'Input something', html: '<p><input id="input-field">', showCancelButton: true, closeOnConfirm: false }, function() { swal({ html: 'You entered:' + $('#input-field').val() }); remarksField.val(#input-field').val());
  20. Hi all. I have a day long solving this problem but any solution I have applied is not working. I have database table named student student $year = $_POST['year']; id name year age Favorite number 1 John College 5 10 2 Carlo College 5 10 3 Peter College 5 10 4 Mae College 5 10 5 Den College 5 10 I want to select all student that there year is college and age is 5 and favorite number is 10 This is my current sql Select * from student where year = '".$year."' and age ="5" and favorite number = "10" My error is when I enter year != College It has still output
  21. THis is my current code but it's not working $sqlgetstud = $mysqli->query("Select stud_id, namestud from students"); while($retvalran = mysqli_fetch_array($sqlgetstud )) { $a = $retvalran['sstud_id']; $b = $retvalran['namestud']; foreach ($a as $key => $b) { $sql = $mysqli->query("Insert into newstudent(stud_id,Name) VALUES('".$key."','".$b."'); } }
  22. I have this code that came from table thing <?php include 'config.php'; $animal_id = 1; //came from animal table(ex. dog) $sql= "Select * from thing order by description desc"; $mysqls = $mysqli->query($sql); while ($row = mysqli_fetch_assoc($mysqls)) { $desc = $row['description']; //ex . pitbull,persian cat,chiwawa $id = $row['id']; echo "<input type='checkbox' name='things[]' value='".$id."'/>$desc<br />"; } ?> How can I save checked checkbox value in another table called Animal_Classification using only 1 button Animal_Classification table should look like this when saved id animal_id thing_id 1 1(ex.dog) 1(ex. pitbull) 2 1(ex.dog) 2(ex. chiwawa) Please help. Thanks
  23. How can I call header("Location:index.php"); when page is manually refreshed/reloaded?
  24. Hi Barand, I want only to redirect to other page if I had refreshed the page. for example, user is currently at www.google.com,then when he refeshed/reloaded the page, he will be redirected to facebook.com. In the example you provided, upon going to the page,it redirects to other page after accessing the first page. Thank you
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.