Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I built an android app which actually retrieve my blog post from some custom feed in XML format.
The data in my blog will increase in the next future so i need to change the way of retrieving data.
I decided to build a PHP webservice to query my posts and answer back to the app the necessary data (as JSON encoded data).
There are two different way to build the webservice: build a direct query to the MySQL database or build a query using the php the_content, php the_title, etc functions (WP_query).
It looks like that querying the My SQL database is more flexible but more complicated.
Which is the best solution between the ones above?
Thanks for your support
I would suggest to use the wp_query because the database may evolve with future Wordpress updates. This means you would have to adapt your mysql query but not you wp_query because the change in the mysql database will have been done by the wordpress update itself.
Furthermore you can have a lot of customization using the wp_query and it's more likely you don't even need to reach the database directly.
Related
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 2 years ago.
Improve this question
I am little new to PHP, MySQL and web development. I have seen MySQL Views are "Virtual Tables" and can be used to represent data table virtually. And my problems are,
Are there any performance increment when we use MySQL Views in a PHP 7 MySQL application?
Are there any security increment?
Can we use MySQL Views for JSON REST API requests?
As far as I know. The view is like you save a query to a database. So you can save time to write a complex query.
I think yes. Because you can grant users access to view rather than directly to the table.
To get the data is yes, but a function like edit and delete I don't think so.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I want to use firebase just a function call just to use my existing database and just to have realtime changes in my site.
Firebase can't magically add realtime functionality to an existing database. It actually has an entire backend infrastructure set up to enable its realtime functionality, which your database would be missing.
Some options:
Build your own realtime functionality on top of your current database.
Synchronize changes to your database with a copy of that data in Firebase, which you then use for updating realtime listeners.
Switch your data model over to Firebase completely.
And I guess the last option is:
Keep using your current database, without realtime options.
None of these is pertinently better or worse than the others, so pick whichever one makes most sense to you and be willing to change your mind along the way.
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 5 years ago.
Improve this question
I've been trying to find I good solution to using MySQL query data for Ajax tables with pagination, sorting and filtering. I've tried DataTables and really don't like it. I started trying FooTables but for some reason I'm having difficulty finding one good complete example of using FooTables with PHP and MySQL data.
What would you recommend for achieving Ajax driven Pagination, Sorting and Filtering with PHP right now that has a good piece of complete working example source code to learn from?
I'm using jQuery but not Bootstrap right now for my web pplications.
Thanks!
http://jtable.org/ might be a good candidate. I am using https://datatables.net/ now but I have used this in the past with good success. Jtable has good documentation and a pretty flexible plugin. The documentation also has sample code with mysql and php.
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 9 years ago.
Improve this question
I am trying to create a site with a tiny CMS, the problem is that there is only php installed on the server.
The site will mainly consit of two pages the user page and admin page. On the user page there is to be a bunch of checkboxes which when checked will do some math(not the problem I need solved). On the admin page you need to be able to add the checkboxes and assing them their values.
My approach was to read and write to a XML file that contains the data instead of a database. I have run into a lot of problems trying to accomplish this, and I am looking for some good ideas for how it can be done, or alternatives.
Thanks in advance.
You can use sqlite as database engine. This way you also create a portable version of your application and by using PDO you could always switch to another database engine later on.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have a small question about performance during dev (web especially) :
Is it better to :
perform operations directly on the DB and retreive a "ready" result
OR
retreive the data from the DB and then do the operations?
Mat is right (see comments): there is no general answer to that. It depends on the structure of your data, on the queries you want to run and on your database system.
Nevertheless I would say, in most traditional cases it is better to join, filter, group, cumulate and sort your data directly in the DB - just because your DB is built to perform exactly this kind of tasks. If your data structure and indexes are built up right, it will be hard to write code beating the database in terms of performance on this actions.
Indeed, there are complex queries where it is better to split it up and do some work in your code. But unless you have more than 10 tables involved or big sub queries, you should not think about this to much.