PHP Classes

exemple

Recommend this page to a friend!

      PHP Database Class Generator  >  All threads  >  exemple  >  (Un) Subscribe thread alerts  
Subject:exemple
Summary:error message on example
Messages:10
Author:alexandru traian
Date:2015-02-18 06:33:57
 

  1. exemple   Reply   Report abuse  
Picture of alexandru traian alexandru traian - 2015-02-18 06:33:58
I replied in require_once("classes/class.group.php"); group with my group just generated but the error still exist like Undefined index: group_name.

  2. Re: exemple   Reply   Report abuse  
Picture of Kamran Shahid Butt Kamran Shahid Butt - 2015-02-18 10:52:48 - In reply to message 1 from alexandru traian
Dear You need to use genrator.php this class and the sample code of this class is aviable in sample-generate.php, once you run the class it will generate the DAL, example.php file is generated by it you dont need to use it, you just use genrator.php file to generate the Data access Layer.

  3. Re: exemple   Reply   Report abuse  
Picture of alexandru traian alexandru traian - 2015-02-18 14:55:16 - In reply to message 2 from Kamran Shahid Butt
I did that and the script works fine. I was wondering what is doing that form from example. Good idea, good script. Maybe one for pdo will be not bad.

  4. Re: exemple   Reply   Report abuse  
Picture of Kamran Shahid Butt Kamran Shahid Butt - 2015-02-19 09:07:35 - In reply to message 3 from alexandru traian
Dear Alexandru,

This script actually a generator for your database, you just need to enter database name it create all the member variables and insert, select, update, delete methods for all tables into database, then you can use this class strucutre in your project, you just need to create a form and then create the object of the class, then call copyPostData or copyGetData depend upon your form type then need to call insert function it insert the object into database and set the primary key of into that object, one thing which need to make sure the name of the fields of form must be same as the database fields for doing mapping of the objects.

You can use this in designing some custom CMS sort of thing or you can design different types of portal using this class strucutre.

Regards

  5. Re: exemple   Reply   Report abuse  
Picture of alexandru traian alexandru traian - 2015-02-19 15:13:39 - In reply to message 4 from Kamran Shahid Butt
Thank you very much for this advices!

  6. Re: exemple   Reply   Report abuse  
Picture of alexandru traian alexandru traian - 2015-02-19 16:01:52 - In reply to message 5 from alexandru traian
Finally it is working. I hope so that it's working well against sqlinjection. Good job !

  7. Re: exemple   Reply   Report abuse  
Picture of Kamran Shahid Butt Kamran Shahid Butt - 2015-02-19 18:12:22 - In reply to message 6 from alexandru traian
For sql injection it will, i am working on its new version as well, that is more powerful. will release it soon.

  8. Re: exemple   Reply   Report abuse  
Picture of alexandru traian alexandru traian - 2015-02-19 18:45:52 - In reply to message 7 from Kamran Shahid Butt
It could look very cool if the classes generate will look like active record from codeigniter.
A guy wrote a very easy to use class and with a good example in Readme.md (http://www.phpclasses.org/package/8861-PHP-Build-and-run-SQL-queries-with-a-fluent-interface.html#usage)
I saw also a part from a mvc framework that if I run the script it will create automatically the tables in database without need phpadmin. You have to do only declare the name of colons (in vars) and attributes in comment above the every field declared in model class. Something like that.
class Example extends Framework\Model
{
/**
* @readwrite
* @column
* @type autonumber
* @primary
*/
protected $_id;
/**
* @readwrite
* @column
* @type text
* @length 32
*/
protected $_name;
/**
* @readwrite
* @column
* @type datetime
*/
protected $_created;
}


  9. Re: exemple   Reply   Report abuse  
Picture of Kamran Shahid Butt Kamran Shahid Butt - 2015-02-20 05:07:39 - In reply to message 8 from alexandru traian
Yes it look great, I think it is drived from Entity Framework of .Net, in Entity Framework we create classes and then by using linq we operate it, classes automatically generate the database script for you and using linq you can use it.

  10. Re: exemple   Reply   Report abuse  
Picture of alexandru traian alexandru traian - 2015-02-20 15:35:43 - In reply to message 9 from Kamran Shahid Butt
Yes, all put together make a good framework or I have to learn Yii. I saw that code in a book from Apress named Pro PHP MVC by Chris Pitt. I built at a moment a framework and I get stuck and the source code didn't help me to much in that time.