Yes please... I have come up with a scenario.. Where I have a datatable where I fetch filtered data from orders. And I want to select some rows for refund. Like from that datatable I want to select some rows as refund request. And Want to put an extra user input column where the executive can put from where that request came from like call or email just a input text. I wnt those checkbox selected rows data to save in another table named refund request. I am able to select that and get the id but can't able to get the values of all the column values for that selected rows.. I used php jQuery Ajax... How can I send those entire row values? Can you please help?
Another great one, thanks bro :) As you touch on JSON, now why cant we explore @wordpress/scripts, and how we can utilize/use React on WordPress in the Wordpress way with WP REST API. Just a suggestion, if possible :)
Great question.. Thank you. Typically, we build all customization in plugins. That way if they decide to change the look, we don't have to bring over all the customization to a new theme.. The plugins should always be able to work on any site. Thank you for watching and commenting..
Greate timing, I have a follow up. So today I stumbled uppon people having placed serialized data into the DB. Which is totally annoying for what I want to do because now I cannot just write a bigger mysql query to pull the data with calculations and grouped in the format how I need it. But I will probably need to write at least 300 lines in php instead of simple 30 lines in sql. Which would also be way more readable than doing all these calculations during loops in php. Specifically, this is about delivery costs for purchase orders for each supplier by country, that have been entered serialized in the supplier table. So my question. Should people be doing this? Cause now I can't use "group by" and probably need to loop through thousend of orders every time I want to do the analysis. Which takes way longer in PhP than in the 3 second sql query... So, where should people use serialized data and where shouldn't they?
Thank you for the question. So it is great to have the data serialized, but yes it can make it difficult or slow to process a database query. If you have access to the code when the order is placed, you could separate those details and put them in as separate data. If not, but you have access to the database: You could run a script (maybe a cron) that would separate out the data you need and put that into a separate table even like as a taxonomy table. New table could be column1:order_id and column2:country. Make sure both columns are indexed (order_id being unique) and then you would be able to quickly do a query when you need to based on country. You could also do that for any searchable data.. Maybe the second column is country, maybe it is "value", but then you would need to make sure that order_id isn't unique, but maybe add an ID that is unique, as it won't let you put in two rows with the same order_id. Hope that isn't confusing and helps!
Hi Joshua Thanks for the great video Actually I am willing to send array from $_POST form to mysql. Just I need to know the best way to send this array as serialized or JSON I see someone here, is mentioned that "Serialization in PHP can be corrupted easily if you save it to database "
Serialization in PHP can be corrupted easily if you save it to database and string replace without changing serialization variable length. No such issue with JSON. And if you need to encode user data as JSON you might simply escape data before pushing it to JSON. This is the main reason why you can not simple search and replace MySQL dump SQL file while migrating to another domain, because it will brake serialized data if such is present.
Always use serialize if saving to the database or sending to another php application. Use json if you don’t know what the other application format will be or if you know for sure it isn’t php.
Let me know if I need to expand on this... I wanted to briefly touch on the differences.
Yes please... I have come up with a scenario.. Where I have a datatable where I fetch filtered data from orders. And I want to select some rows for refund. Like from that datatable I want to select some rows as refund request. And Want to put an extra user input column where the executive can put from where that request came from like call or email just a input text. I wnt those checkbox selected rows data to save in another table named refund request. I am able to select that and get the id but can't able to get the values of all the column values for that selected rows.. I used php jQuery Ajax... How can I send those entire row values? Can you please help?
Awesome video
Thank you!
Great! I need tutorials wp development non-standart themes and plugins! It's needed all over the world🌏 developers
Thank you
LOVE ❤ This tutor! 🌟
Thank you!
Another great one, thanks bro :)
As you touch on JSON, now why cant we explore @wordpress/scripts, and how we can utilize/use React on WordPress in the Wordpress way with WP REST API. Just a suggestion, if possible :)
Awesome.. Thank you for watching and commenting.. I will add that to the list of videos to make.
Awesome content, when do you decide as a developer to build a feature as a plugin or with the custom theme? Thanks
Great question.. Thank you. Typically, we build all customization in plugins. That way if they decide to change the look, we don't have to bring over all the customization to a new theme.. The plugins should always be able to work on any site. Thank you for watching and commenting..
@@jherbison Interesting!👍
Thank you.
Thanks for the video!
Greate timing, I have a follow up. So today I stumbled uppon people having placed serialized data into the DB. Which is totally annoying for what I want to do because now I cannot just write a bigger mysql query to pull the data with calculations and grouped in the format how I need it. But I will probably need to write at least 300 lines in php instead of simple 30 lines in sql. Which would also be way more readable than doing all these calculations during loops in php. Specifically, this is about delivery costs for purchase orders for each supplier by country, that have been entered serialized in the supplier table. So my question. Should people be doing this? Cause now I can't use "group by" and probably need to loop through thousend of orders every time I want to do the analysis. Which takes way longer in PhP than in the 3 second sql query... So, where should people use serialized data and where shouldn't they?
Thank you for the question. So it is great to have the data serialized, but yes it can make it difficult or slow to process a database query. If you have access to the code when the order is placed, you could separate those details and put them in as separate data. If not, but you have access to the database: You could run a script (maybe a cron) that would separate out the data you need and put that into a separate table even like as a taxonomy table. New table could be column1:order_id and column2:country. Make sure both columns are indexed (order_id being unique) and then you would be able to quickly do a query when you need to based on country. You could also do that for any searchable data.. Maybe the second column is country, maybe it is "value", but then you would need to make sure that order_id isn't unique, but maybe add an ID that is unique, as it won't let you put in two rows with the same order_id. Hope that isn't confusing and helps!
Hi Joshua
Thanks for the great video
Actually I am willing to send array from $_POST form to mysql.
Just I need to know the best way to send this array as serialized or JSON
I see someone here, is mentioned that "Serialization in PHP can be corrupted easily if you save it to database "
Serialization in PHP can be corrupted easily if you save it to database and string replace without changing serialization variable length. No such issue with JSON. And if you need to encode user data as JSON you might simply escape data before pushing it to JSON. This is the main reason why you can not simple search and replace MySQL dump SQL file while migrating to another domain, because it will brake serialized data if such is present.
Have some way in javascript to serialize like a PHP, i need pass a array to api and this request its a PHP serialize format not JSON.stringfy :z
When should we use Json and when should we use serialize
Always use serialize if saving to the database or sending to another php application. Use json if you don’t know what the other application format will be or if you know for sure it isn’t php.
@@jherbison Thanks Josh, am actually just starting to learn php, the tutorials are awesome
@@philip9677 Thank you.. That is great that you are starting to learn php.