Jump to content

Arrange Data in Tables using PHP


djxyas

Recommended Posts

Dear sir

 

I am stuck in one problem, I want to display data in the tables using PHP, data will be accessed from MySQL. It should have a delete function, edit function and view function.

 

An example of what I need is attached.

 

Can please somebody make an easy code for it and paste it. I will appreciate your help.

 

Regards

 

Shawn

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/48985-arrange-data-in-tables-using-php/
Share on other sites

http://www.google.com/search?hl=en&q=php+mysql+datagrid

 

You are basically asking for someone to create all of your code for you, not going to happen. If you want that goto the freelance form. If not I suggest looking into a PHP Datagrid. The code is already done.

Can please somebody make an easy code for it and paste it.

 

PHP Help is found on the PHP HELP forum!!!

For complete custom written scripts you should go to the freelance forum like "frost110" suggested (AND AS THE FORUM RULES STATE)

for complete script you could also search http://www.hotscripts.com

 

 

nice day, dear sir

At it's most basic,

<?php
include 'db.php';    //connnection stuff

function table2Table($tname) {
    $result = mysql_query("SELECT * FROM `$tname` ");

    $str = "<TABLE border='1' cellpadding='4'>\n";

    // column headings
          $str .=  "<tr>\n";
          while ($fld = mysql_fetch_field ($result)) {
                   $str .= "<th>{$fld->name}</th>\n";
          }
          $str .=  "</tr>\n";
      

    // list data
          while ($row = mysql_fetch_row($result)) {
          $str .=  "<tr>\n";
          foreach ($row as $field) {
                   $str .=  "<td>$field</td>\n";
          }
          $str .=  "</tr>\n";
    }

    $str .=  "</TABLE>\n";
    
    return $str;
}

// call function
echo table2Table('mytablename');
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.