CRUD for MySQL and PHP [closed]

蹲街弑〆低调 提交于 2019-11-30 13:00:14

问题


I have to make some database requests with PHP on a MySQL database.

Question : What is the best (simpliest) framework to get thing done right CRUD (Create Read Update Delete)?

I also have to populate the database, what is a good tool to do that. The only one I know is SqlMyAdmin, wich does not look good. An online tool would be great.

Your experience is valuable: tell me what do you use and why ?


I have taken a look at CodeIgniter, looks nice, what do you think... overkill ?


回答1:


For lots of operations (especially CRUD, which work out of the box once you've written the schema files), the ORM Framework Doctrine is really great.

If you want to go farther than just DB access, you might take a look at the PHP FRamework symfony, which provides an admin generator (there is even a screencast about that one). (And has great documentation, such as the jobeet tutorial) (BTW, symfony uses Doctrine as ORM ^^ )

But maybe it's a bit overkill (and requires a too big learning curve) if you need something simple...

To load data to MySQL, what about LOAD DATA INFILE, which (quote from the docs) "reads rows from a text file into a table at a very high speed".




回答2:


I recommend GroceryCRUD because of the good engineering and documentation

  1. Copy files into your web folder
  2. Configure MySQL database
  3. Specify MySQL table name

=> You get a paginated JqueryUI table with create/edit/delete buttons.

create/edit opens a form page based on the MySQL table schema. For example, a boolean, a varchar and a text get turned into a form with active/inactive radio buttons, a text field and a wysiwyg html editor.

Note: GroceryCRUD is built on CodeIgniter so you will have a copy living in your admin directory. You don't have to use it for building your main site.

Security Advisory: Any library can have undiscovered security vulnerabilities, so it is recommended to minimize exposure by protecting your copy of GroceryCRUD with BaseAuth and permitting SSL access only.




回答3:


I'd second Pascal's comment re Symfony (I would uprate but not enough credit :-() - Symfony has a great admin generator, and once you get your head around the app->module->actions concept, it's straightforward and the documentation is fantastic, even if it is sometimes easier to search Google for it ;-)

Failing that, CakePHP is a lot better now than it used to be back in the early days, and you can get going with the minimum of fuss, particularly with their scaffolding which will help you set up a basic CRUD-style setup. Their documentation is also pretty awesome and very easy to read :-)




回答4:


If solutions such as Doctrine, CAKE, CodeIgniter, etc. seem like overkill for what you're trying to do, I'd recommend a one-file PHP script I built that lets you CRUD hierarchical data in MySQL:

http://coding.pressbin.com/109/PHP-One-file-CRUD-front-end-for-hierarchical-MySQL-data/




回答5:


Why do not you try to code it from scratch as CRUD is a common task of programming. There are lots of good tutorials:

1>PHP PDO + Bootstrap Twitter: http://www.lizardgrid.com/blog/php-crud-tutorial-part-1/

2>JQuery + PHP: http://www.codeofaninja.com/2013/05/crud-with-php-jquery.html




回答6:


I am currently testing JqGrid (a Jquery Table Library).

I have tried Grocery CRUD: looks nice, but its Datatables theme (which has column filtering ability) won't work with server-side processing, that's why I dropped it.




回答7:


You may have a look at Cygnite Framework

It does basic code generation. Controller, model, views, layout, pagination, form component, required field validation, with bootstrap template etc. all these generate with simple command. You may alter the code based on your need.

Here is the tutorial- Generate CRUD application within 2 Min

Worth looking.




回答8:


I'd say that totally depends on what you need to do.

You do know phpMyAdmin, right? You can import from a lot of formats with that tool.

Or do you want to develop an application with simple CRUD operations? Then a framework like Symfony or Zend Framework would be the right thing to be looking for.




回答9:


I developed this script which reverse engineers from a MySQL database a set of stored procedures that list all the rows of a table, a single row based on the primary key, updates/inserts based on the primary key and deletes based on the primary key. It assumes that you already have your tables created with the primary keys setup per table and it generates the MySQL stored procedures for you. I have found that this is more efficient than similar types of solutions developed in PHP.




回答10:


Something like http://www.notorm.com/ might be more appropriate than Symfony. Whilst I like Symfony and have used it to great effect, it is not simple.

Likewise with Codeignitor I would argue that any full stack framework (Laravel, Zend, Wii etc . . ) would not fit the remit of "simple".




回答11:


A fairly straight forward and effortless crud system i found is https://github.com/usmanato360/crud360 its very easy to setup and there are loads of advanced features. It is unlike traditional crud systems that generate model classes etc.. it is just a single class that takes care of everything dynamically.



来源:https://stackoverflow.com/questions/1148388/crud-for-mysql-and-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!