PHP, MySql, Datagrid

I am using PHP 5.2.0 and MySQL 2005.

I have a table in MySQL having two Columns EmployeeNames and JobProfile.

As of now i am just reading the content of the table and displaying on a webpage(.php).

But now in addition with displaying on the webpage i need to provide the option for making changes in the data from the webpage itself.

How can we implement datagrid(of asp.net) or anything which is quite similar to it in order to provide the option for add, delete, update and save the details of the employee in the database from the webpage(.php) itself.

Alongwith i need to provide a button which generate a text file after clicking on it and that text file suppose to contain only name of the employees those are currently on the database or webpage.
pradeep_bansalAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SwafnilCommented:
There are various PHP datagrid components available on the internet, most of them being commercial.

apPHP.com offers a Pro version of their PHP-Datagrid but they also have a discontinued free version of their grid available for download that should do the job.

Have a look at the free edition (just scroll down to the bottom of the page to see the examples):

http://www.apphp.com/php-datagrid/index.php?page=examples

Download requires registration but it doesn't cost anything.

Hope that helps!

As for your second task, downloading a list of persons from the database isn't really much of a problem. Just have a link to the page attached to this post which will give you a semi-colon divided list of employees to use in i.e. Excel
<?php
$conn = mysql_connect("localhost", "USERNAME", "PASSWORD"); // open connection with your username and password
if (!$conn){
  die("Failed to connect!");
} else {
  // select the appropriate database containing the users
  if (mysql_select_db("DBNAME", $conn)){ 
    die("Database DBNAME not available!");
  }     
}  

// create the query, in this case employees will be ordered by lastname and firstname 
// (please check the column names and table name if they are applicable for your mysql table)
$sql = "SELECT firstname, lastname FROM employees ORDER BY lastname, firstname";
// perform the query
$res = mysql_query($sql, $conn);
if ($res){
	// loop through the resultset
	print "LASTNAME;FIRSTNAME;\n";
	while ($row = mysql_fetch_assoc($res)){
		print $row["lastname"].";".$row["firstname"].";\n";
	}
}
mysql_close($conn);
?>

Open in new window

0
pradeep_bansalAuthor Commented:
Thanks Swafnil, but i am not able to download the grid from the link you provided as there is no option for downlaoding, but you can copy the code from there itself well i am working with that code and will let you once i complete the code.
if you have any other option for creating the datagrid then please let me know.
Thanks In Advance
0
Alexandre SimõesManager / Technology SpecialistCommented:
I don't know any PHP but I like jqGrid very much and use it a lot.
http://www.trirand.com/blog/

It supports inline or form editing out-of-the-box... it's great.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

SwafnilCommented:
Good Morning,

it just takes a few steps to get your hands on ApPHP's datagrid, just tried it myself.

1.) Go to http://www.apphp.com/php-datagrid/index.php?page=examples
2.) Hit the "Downloads" link on the left side
3.) Scroll down to the bottom where it says "Download PHP DataGrid (Free Edition)" and click "Download last 4.2.8 (PHP5)"
4.) Create a free account on the next page
5.) Submit and check your mail account for the activation mail
6.) Click the link inside the activation mail, you will be redirected to the login page
7.) Log in
8.) Click the link "10 free products" and you will see the download for the DataGrid
9.) Download and unpack
10.) Installation information is available in the /docs folder

Btw, which database are you using? I just read "MySQL 2005" but as far as I know there is no MySQL 2005, only MSSQL 2005 and MySQL 5. The mentioned grid is only available for MySQL, don't know if there is a PHP datagrid component available for MSSQL. If that's the case, why not write an aspx app which integrates into a PHP application? I could get you started if you need some help!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dhanasekaran SengodanCommented:
flexigrid
========
Lightweight but rich data grid with resizable columns and a scrolling data to match the headers, plus an ability to connect to an xml based data source using Ajax to load the content.

Similar in concept with the Ext Grid only its pure jQuery love, which makes it light weight and follows the jQuery mantra of running with the least amount of configuration.

Features

    * Resizable columns
    * Resizable height and width
    * Sortable column headers
    * Cool theme
    * Can convert an ordinary table
    * Ability to connect to an ajax data source (XML and JSON[new])
    * Paging
    * Show/hide columns
    * Toolbar (new)
    * Search (new)
    * Accessible API
    * Many more



http://www.flexigrid.info/
0
pradeep_bansalAuthor Commented:
Hi Swafnil,

Thanks for providing such useful information. I am using MySQL as a DB. I have downloaded the grid from the link you have provided and will try on it and let you know.

Thanks
0
pradeep_bansalAuthor Commented:
Hi All,

I have two columns in the mysql databse(EmployeeNames and JobProfile). I want to fetch the data of these columns and want to display on the webpage. This is done.

Now, alongwith displaying on the webpage i would like to provide an option for add, delete and update the data from the webpage itself.

These data is also stored in the text file (only employee names) and that text file is read by a vbscript for different purpose.

I have tried with the datagrid and i have sucessfully deployed it except few glitches but for this small thing datagrid would not be a better choice.

Need a very simple and accurate solution.

Thanks In Advance.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.