Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Search results

  1. Roy Harper

    PHP spl_autoload_register returns error

    Hello. I am trying to use spl_autoload_register but it returns an error saying "Uncaught Error: Class 'Functions' not found in..." Here is my code: spl_autoload_register(function($className) { $path = "classes/"; $extension = ".php"; $fullPath = $path.$className.$extension...
  2. Roy Harper

    Calculate leave days based on leaveStart and leaveEnd

    I am trying to calculate the total leave days based on two dates. I tried using datediff and timestampdiff but it gives me the wrong result. For example I input: leaveStart = "2022-04-26" leaveEnd = "2022-04-27" So the total leave days should be 2 days because the leave is from 26 to 27...
  3. Roy Harper

    Barcode Scanner

    Uhm, I'm trying to make some sort of inventory system. The products already have barcodes. Now I want to scan those barcodes and the result will reflect on a textbox. Is there a free barcode API that I can integrate? TY.
  4. Roy Harper

    Barcode Scanner

    Hi, I am trying to integrate barcode scanner on my website. Can anyone recommend me some free barcode reader API or something that I can use? I have searched on the internet and most of the results have pricing. Thanks.
  5. Roy Harper

    LAG() not working on phpmyadmin

    I created a view for weekly sales. Everything is working fine on localhost using MySQL. But when I upload the database on GoDaddy Lag doesn't seem to work. When I am typing LAG on phpmyadmin, no suggestion is showing. Can anyone help me with this one? Thanks the structure of vw_sales is...
  6. Roy Harper

    JavaScript Prevent typing letters on input not working on mobile.

    I recently noticed that my website input validation of prevention of letter typing is not working on mobile. I can freely type anything on the input. While on desktop, it works just fine. What should I do? function validateNumber(event) { var key = event ? event.keyCode : event.which; if...
  7. Roy Harper

    JavaScript Add/remove element on button click, based on checked checkboxes

    I am creating messaging process but I encounter problem with marking messages as important/unimportant. What I am trying to achieve is, if I mark those messages as important, I will append that icon to specific element. And if I mark it again as unimportant, the icon will be removed. However...
  8. Roy Harper

    Prepared statements needs to be re-prepared.

    I tried uploading my website on 000webhost but I am getting error "Prepared statements needs to be re-prepared." I search through the internet and found these two solutions: It happens every time I query through views table. 1. Increase table_definition_cache - The problem is, 000webhost does...
  9. Roy Harper

    Fun activity Say hello... in a coding language!

    $name = "Nous"; echo "Hello " . $name;
  10. Roy Harper

    Hi!

    I'm a bit new to this forum and also a beginner in programming. And so far, I've had some help with fellow programmers. Thank you so much!
  11. Roy Harper

    PHP Generating unique txID or Using auto_increment in SQL

    I am just curious as to why others generate unique strings or ID for transactions or orders when they can just use the primary key in SQL. Is it recommended to generate id like this 111834039007163223, or is it okay to just use the primary key in SQL generated using auto_incement? I always see...
  12. Roy Harper

    PHP How to resize an image with fixed height but auto size the width in PHP?

    Never mind, I have already solved it using this formula: $new_heigth = 300; // Resize image $new_heigth = 300; $ratio = $original_width / $original_height; $new_width = ceil($ratio * $new_height);
  13. Roy Harper

    PHP How to resize an image with fixed height but auto size the width in PHP?

    I created a function that resize an image. But I only want to define the target height and then auto size the width. For example if I have a 840x360. My target height is 250 and I want to auto compute the width to maintain it's ratio. So far I can only resize the image based on the resolution...
  14. Roy Harper

    JavaScript How does setInterval() affect the website's performance?

    Thanks for pointing out how it can affect the server, I have not think of that. On the contrary, I am just using this code on admin site, which means only one user is requesting this data. Do you think it'll be okay? Regardless, Web Sockets and node.js seems like a way to go. I'll be studying...
  15. Roy Harper

    JavaScript How does setInterval() affect the website's performance?

    I created a notification system in my website. In order to get the latest notifications like someone places, paid, or cancelled the order, I created a function and put it inside the setInterval(). My question is, does it somehow affect the performance of the website as it constantly downloading...
  16. Roy Harper

    Changing datetime in computer affects CURRENT_TIMESTAMP in SQL

    I actually did this before I change my database design with created_at using CURRENT_TIMESTAMP. I guess I'm going back return it to my old code, which is manually saving the date to db.
  17. Roy Harper

    Changing datetime in computer affects CURRENT_TIMESTAMP in SQL

    I have blog page in my website. Whenever I write a blog, I only save the content of the blog, and let the SQL handle the current timestamp. So my code goes like this: CREATE TABLE blogs( blogID INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, title VARCHAR(255) NOT NULL, content TEXT...
  18. Roy Harper

    How to select records if the total from another table is not equals to Zero (0)?

    I have a product categories listed in my website. But, I don't want to show categories that has 0 products under it, as you can see in the image below. Here is my code: SELECT c.category AS category, (SELECT COUNT(*) FROM products AS p WHERE p.categoryID =...
  19. Roy Harper

    PHP Alternative way to handle records filter in PHP

    I have a product page which has filters like search, category, and sort by (name, price). And my code goes like this. if(isset($_GET['category'])){ $products = $cakeOrdering->get_data("SELECT productID, prod_name, price, image FROM products WHERE categoryID = ? ORDER BY productID DESC LIMIT...
Back
Top Bottom