I am trying to make a facebook style chat page using php and mysql. But i have a problem with my query result. The chat table looks like this. And i write this function for getting the message for …
Tag: php
Modifying the keys in a PHP array before sending to JSON
I am querying a SQL database and returning some values. What I have is Field1 and Field2 which come out with a list of dates (There may be up to 200 values/dates eventually). I then reformat the …
Count number of orders for a variation in Woocommerce
I have figured a way to do this, but I am finding my queries are taking way too long, and the more orders in Woocmmerce, and the more variations we add, the longer the query takes… I would hope there is a way in WC or WP to query just variation ids of an order, but alas, I havent found
Sort Orders IDs alphabetically based on the shipping last name in Woocommerce
I need to sort my $order_name (more specifically $order_shipping_last_name) alphabetically. I’ve tried many different basic php sort() methods, in many different places, and can’t get this to work. I’m assuming I’m missing something? In my code, get_all_orders_that_have_a_product_variation( $product_id ); function comes from this answer code that allow to get an array of orders IDs from a variation ID… The list
Get the count of newly published product (today) in WooCommerce [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago. Improve this question I have a WooCommerce site where products are considered as trade/deal. Therefore, when someone take a trade (buy a product),
Show the posts which have specific tags or categories
I want to show the posts which have specific tags or categories as I mentioned in the title; for example, one of my posts has 3 tags “php”,”laravel”,”regex” I want to get those posts that have laravel tag in their many to many relationships. Answer First, make sure you have set the right relations on your models. then use Querying
How to prioritize result in laravel eloquent
I have a table with 4 columns. I want to display the row based on input and it should be able to display with priority according to the priority fields. example: My table looks like this: I have my test cases below how it should work: Now, I want to prioritize the result from title down to tags based in
i can’t display/access images from the mysql database using php
I was able to design a code to upload image and other data to the database and also display some of those data. Everything works but the image doesn’t display and the messages too don’t come up when …
Why is the `LIKE` operator not working with integer columns?
I’m trying to receive some ids from my database for an autocomplete search on my CAKEPHP 3.3 site. But my problem is that its only returning the id if I type in the exact id and not part of it. Here …
Inserting data into MySQL from a dropdown
I’m trying to make a dropdown list that allows users to select a training program that matches their needs, so when they select it, the option will go into a table in the MySQL database. This is my HTML form: What I need is an SQL query that will go with it, so when they select ‘Example option 3’, it