PHP Classes

Recommendation for a PHP class to order table by column: Print sorted data from reading html table

Recommend this page to a friend!
  All requests RSS feed  >  Recommendation for a PHP class to ord...  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

Recommendation for a PHP class to order table by column

Edit

Picture of Mario Fuentes by Mario Fuentes - 4 years ago (2020-06-27)

Print sorted data from reading html table

This request is clear and relevant.
This request is not clear or is not relevant.

+2

I need to print data sorted by sale price from a html table on this site:

https://www.realestateabc.com/home-values/detail/TX/San+Antonio/7703+Lynn+Anne+St

Location		History			Room Count		Square Feet		
Property Address	Proximity	Sale Date	Sale Price	Built In	Beds	Baths	Building	Price Per	Lot

Subject Property

7703 Lynn Anne St 0 mi N/A N/A 1977 3 2 1,891 $115 9,774

Recent Sales in this Area

								

A 15814 Cotton Tail Ln 4.2 mi 08-30-2019 $242,000 2005 3 3 2,431 $100 5,662

B 7411 Slippery Elm St 0.9 mi 05-20-2020 N/A 1976 3 2 1,360 $138 8,833

C 8411 Upton 0.7 mi 10-18-2019 $142,500 1987 4 4 2,653 $54 10,454

D 8102 Raritan St 0.3 mi 08-30-2019 $178,500 1978 4 2 1,788 $100 8,712

E 9422 Tranquil Park Dr 0.5 mi 08-16-2019 N/A 1993 4 3 2,145 $121 7,405

F 7410 Brian Clarke St 0.3 mi 06-05-2020 N/A 1979 6 4 3,105 $92 9,517

G 9215 Johnny Reb Dr 0.9 mi 06-15-2020 N/A 2020 3 2 1,657 $142 5,227

H 7615 Briston Park Dr 1.1 mi 08-16-2019 $269,000 1994 4 3 3,288 $82 8,276

I 6703 Secession Ln 0.9 mi 11-22-2019 $245,000 1986 4 3 2,268 $108 8,276

J 9520 Legend Isle Dr 0.7 mi 09-05-2019 $305,000 1993 4 3 2,754 $111 10,454

K 8675 Bristlecone St 0.6 mi 05-18-2020 $227,000 1977 3 2 1,714 $132 7,840

L 8211 Lynbrook Manor Dr 0.5 mi 12-18-2019 N/A 1992 4 3 2,696 $130 11,325

M 8627 Tanbark Dr 0.6 mi 12-20-2019 N/A 1977 3 2 1,426 $126 7,440 N 10508 Lost Blf 0.7 mi 10-30-2019 N/A 1993 4 3 2,782 $82 6,969 O 8423 Kingsway St 0.7 mi 08-01-2019 N/A 1980 4 3 2,438 $114 9,583 P 8827 Breanna Oaks 0.9 mi 10-15-2019 $297,500 2013 3 3 2,097 $142 7,840 Q 8683 Tanbark Dr 0.5 mi 11-26-2019 $175,000 1977 4 2 1,443 $121 11,761 R 8414 Kingsway St 0.7 mi 08-22-2019 N/A 1979 3 2 1,808 $124 9,583 S 8834 Thatch Dr 0.6 mi 12-06-2019 N/A 1977 4 2 1,413 $127 7,405 T 7727 Autumn Blf 0.8 mi 07-26-2019 $186,000 1993 4 3 2,092 $89 5,662 U 8006 Cerezo 1.0 mi 02-24-2020 $183,500 2002 3 3 1,698 $108 6,534 V 9610 Fonthill Dr 0.9 mi 12-13-2019 N/A 1992 4 3 2,474 $119 7,840 W 8435 Chivalry St 0.8 mi 09-18-2019 N/A 1975 3 2 1,946 $123 9,583 X 7439 Elderberry St 0.7 mi 02-05-2020 $185,000 1976 3 2 1,360 $136 7,840

Newbie... trying to understand the language would like to start with this specific need .. tks

  • 1 Clarification request
  • 1. Picture of Manuel Lemos by Manuel Lemos - 4 years ago (2020-06-29) Reply

    Hello Mario,

    Is that data retrieved from a database, a CSV file, hardcoded in your site code, or some other source of data?

    Ask clarification

    1 Recommendation

    CMySqldbHTML: Display and edit MySQL table records in a Web page

    This class can display and edit MySQL table records in a Web page.

    It can connect to a given MySQL database and retrieves data from that table to display it on a Web page.

    The class can also display a form to allow the user to enter data to insert in new records of the given MySQL table.

    In Spanish:

    CMySqldbHTML esta diseñado para la interacción con bases de datos mysql phpmyadmin y generar HTML a partir de los datos.
    CMySqldbHTML is designed for the interaction between data bases mysql phpmyadmin and and create HTML code with the data.
    El constructor requiere los parametros - The constructor parameters are:
    * $tablenm = Nombre de la tabla - Name of the table
    * $db = Nombre de la base de datos - Name of data base
    * $host = Nombre o direccion del host o servidor - Name or adress of the host or server
    * $user = Nombre de usuario para conexion con la base de datos - User name to connect with the database
    * $pass = Conrtaseña para conexion con la base de datos - User password to connect with the database
    *
    * Hay dos formas de usar la clase - There are two ways for the use of the class:
    *
    * 1.- $tablenm = "": Si entregamos el nombre de la tabla vacio - If set the table name empty
    * $data : Almacena los nombres de las bases de datos - Save the names of the databases
    * $tblsdb : Almacena los nombres de las tablas de la base de datos entregada
    - Save the names of the tables in the database gived
    *
    * 2.- $tablenm <> "": Entregando el nombre de una tabla existente - Setting the table name created.
    * $numfilas : Numero de filas de la tabla - Numbers of rows in the table
    * $numcols : Numero de columnas de la tabla - Numbers of columns in the table
    * $hddata : Encabezados de la tabla - Table headers
    * $tpar : Tipos de campos de la tabla - Types of table fields
    * $lenar : Longitud máxima para los campos de la tabla - Maximum length for the table's fields
    * $bandar : Banderas de los campos de la tabla - Flags for the table's fields
    * $data : Almacena el contenido de la tabla por filas - Save the rows content of the table
    *
    * Metodos:
    *
    * showrCObjeto() :
    * 1.- Escribe el codigo HTML para ver la lista de las bases de datos y las tablas de la base de datos asignada
    * - Write the HTML code to see the list of databases and tables of the assigned database
    * 2.- Escribe el codigo HTML para ver la tabla con sus encabezados
    * - Write the HTML code to see the table with its headings
    *
    * Solo para caso 2 - Only case two(2).
    * getrowdata($id,$colid)
    * Devuelve un array con los datos del $id, de encontrarlo en la columna o encabezado $colid
    * Returns an array with the $id data, if found in the $colid field
    *
    * drawrowdata($id,$colid)
    * Escrible el codigo HTML en una tabla con los datos del $id encontrado en la columna $colid
    * Write the HTML code in a table with tha $id data, if found in the $colid field
    *
    * Para formularios - To forms
    * setArcolno($ar)
    * $arcolno = $ar, que son los campos que no queremos que dibuje en el formulario,
    * como timestamp o autoincremto u otro caso.
    *
    * drawForm($nm)
    * Escribe el codigo HTML de un formulario con los nombres de los campos de la tabla como etiquetas
    * remplazando '_' con ' ', para darle presentacion, y poder usar dichos nombres como name en los input
    * del formulario para su posterior captura con el metodo _POST.
    * El primer input lo hace autococus y crea un tabindex para el form.
    * Caracteristicas especiales:
    * $arcolno permite que en el formulario no dibuje determinados campos, como timestamp o autoincremto u otro caso.
    * $nm es el dato de autorrelleno para el primer campo, en caso de tenerlo lo autorrelena y solo lectura.
    * De lo contrario entregamos $nm=''.
    *
    * Write the HTML code of a form with the names of the fields in the table as labels replacing '_' with ' ', to give
    * presentation and be able to use these names as name in the input of the form for later capture with the _POST method.
    * The first input is done by autococus and creates a tabindex for the form.
    * Special features:
    * $arcolno allows the form not to draw certain fields, such as timestamp or autoincremto or another case.
    * $nm is the autofill data for the first field, if you have it, the self-fill and read only.
    * Otherwise we deliver $nm=''.
    *
    * getcmpsForm():
    * Devuelve un array con los nombres de los encabezados - Return an array with header names
    *
    * procForm($arrfrm):
    * Procesa y graba los datos capturados y recibidos en $arrfrm, usa las variables $tstmp y $ord para identificar y
    * autorellenar, ya que normalmente son campos que el formulario no dibuja, y deben estar en $arcolno.
    * Para su uso despues de construir el objeto, damos valor a las variables con setTstmp($ts) y setOrd($o).
    * It processes and records the data captured and received in $ arrfrm, uses the variables $ tstmp and $ ord to identify
    * and autofill, since they are normally fields that the form does not draw, and they must be in $ arcolno.
    * For use after building the object, we give value to the variables with setTstmp ($ ts) and setOrd ($ o)
    *
    * Getters and Setters
    * getData() return $this->data;
    * getNumfilas() return $this->numfilas;
    * getNumcols() return $this->numcols;
    * getHddata() return $this->hddata;
    * getTblsdb() return $this->tblsdb;
    * getTablenm() return $this->tablenm;
    * setArcolno($ar) $this->arcolno = $ar;
    * getArcolno() return $this->arcolno;
    * setTstmp($ts) $this->tstmp = $ts;
    * setOrd($o) $this->ord = $o;
    *
    * @author Luis Gabriel Hernández - alias or nickname: luisga158
    This recommendation solves the problem.
    This recommendation does not solve the problem.

    +1

    Picture of Manuel Lemos by Manuel Lemos Reputation 26695 - 4 years ago (2020-07-04) Comment

    If your data is retrieved from a MySQL database, you may want to try this package that not only can list the data that is already in the tables, but also allow users to add, update and delete existing table records. It uses the MySQLi extension, so it works in the latest PHP versions.


    Recommend package
    : 
    :