2

I have been experimenting with Python Django, and what I really liked was creating a database table from a model created in Python.

I would love to do the same with PHP. I have been plowing through Packagist without any luck. So I started working on something myself. And you guessed it, it became a project on its own now.

Does anyone know any library, preferably on Packagist that does this? Any other suggestions would be welcome. Also, don't hold back on commenting this method in general. However I really believe that this concept is valuable.

Note: I just like the idea of not having manage all kinds of models in MySql workbench for small projects.

1 Answer 1

1
use mysqli or pdo.

Then you input a standard SQL statement in and execute it.
$db=mysqli_connect('localhost','root','xxxx');
mysqli_select_db($db,'db');
mysqli_query($db,"create table scooby { col1 varchar(300),col2 varchar(10);}");

A very simply example with no error checking.

2
  • 3
    Thanks. I know mysql. I'm looking more for a model/oop library through which I can manage the tables. Also I would like to update databases without losing the data contained in the database already. Like CTRL+Y in mysql workbench, let's say.
    – Matt
    Dec 28, 2016 at 22:13
  • Not what you are looking for (I think), but stil very well worth taking a 30 second look at grocerycrud.com/examples That should be enough to show its usefulness Mar 29, 2017 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.