PHP Classes

How to Create a Materialize PHP Application Using the Package Materialize PHP: Manage user records in pages using Materialize CSS

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2025-04-28 (2 days ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
materializephp 1.0MIT/X Consortium ...5HTML, PHP 5, Databases, Applications
Description 

Author

This package can manage user records in pages using Materialize CSS.

It provides a small application that allows users to perform several types of operations with user records.

Currently, it provides to:

- Create new user records

- Edit user records

- Delete user records

- List user records

The pages are presented using Materialize CSS library.

The user records are stored in MySQL database using the PDO extension.

Picture of Rodrigo Faustino
  Performance   Level  
Innovation award
Innovation award
Nominee: 24x

Winner: 4x

 

Instructions

Please check these example scripts to learn how to:

Example

<?php

// include database and object files
include_once '../classes/database.php';
include_once
'../classes/user.php';
include_once
'../classes/category.php';
include_once
'../initial.php';

// for pagination purposes
$page = isset($_GET['page']) ? $_GET['page'] : 1; // page is the current page, if there's nothing set, default is page 1
$records_per_page = 5; // set records or rows of data per page
$from_record_num = ($records_per_page * $page) - $records_per_page; // calculate for the query limit clause

// instantiate database and user object
$user = new User($db);
$category = new Category($db);

// include header file
$page_title = "Usuários";
include_once
"../include/header.php";

// create user button
echo "<div class='right-button-margin'>";
echo
"<a href='create.php' class='btn info pull'>";
echo
"<i class='fa fa-plus-square' ></i> Criar Novo";
echo
"</a>";
echo
"</div>";
echo
"<a class='waves-effect waves-light btn modal-trigger' href='#modal1'>Novo</a>";

// select all users
$prep_state = $user->getAllUsers($from_record_num, $records_per_page); //Name of the PHP variable to bind to the SQL statement parameter.
$num = $prep_state->rowCount();

// check if more than 0 record found
if($num>=0){

   echo
"<div class='w3-responsive'>";
echo
"<input type='text' id='myInput' onkeyup='mybusca()' placeholder='Procure o Nome..'>";
include_once
'pagination.php';
echo
"<table id='myTable' class='w3-table w3-bordered w3-border w3-card-4'><tr class='header'>";
    echo
"<tr>";
    echo
"<th>Ação</th>";
    echo
"<th>Nome</th>";
    echo
"<th>Sobrenome</th>";
    echo
"<th id='esconder'>E-Mail</th>";
    echo
"<th>Telefone</th>";
    echo
"<th>Perfil</th>";
    echo
"<th>Ação</th>";
    echo
"</tr>";

    while (
$row = $prep_state->fetch(PDO::FETCH_ASSOC)){

       
extract($row); //Import variables into the current symbol table from an array

       
echo "<tr>";
        echo
"<td>";
       
// edit user button
       
echo "<a href='edit.php?id=" . $id . "' class='btn warning left-margin orange' >";
        echo
"<i class='fa fa-pencil-square-o' ></i><label id='esconder' style=color:white> Editar</label>";
        echo
"</a>";
        echo
"</td>";
        echo
"<td>$row[nome]</td>";
        echo
"<td>$row[sobrenome]</td>";
        echo
"<td id='esconder'>$row[email]</td>";
        echo
"<td>$row[celular]</td>";
        echo
"</td>";
        echo
"<td>";
                   
$category->id = $category_id;
                   
$category->getName();
                    echo
$category->nome;
        echo
"</td>";

        echo
"<td>";
      

       
// delete user button
       
echo "<a href='delete.php?id=" . $id . "' class='btn waves-effect waves-light btn modal-trigger' onclick='getId($id)'>";
        echo
"<i class='fa fa-trash'></i><label id='esconder' style=color:white> Excluir</label>";
        echo
"</a>";

        echo
"</td>";
        echo
"</tr>";
    }

    echo
"</table><br>";

   
// include pagination file
   
}

// if there are no user
else{
    echo
"<div> No User found. </div>";
    }
?>
<div id="modal1" class="modal bottom-sheet">
    <div class="modal-content">
      <h4></h4>
     
    </div>
 
  </div>

<?php
include_once "../include/footer.php";
?>


  Files folder image Files (55)  
File Role Description
Files folder imageclasses (5 files)
Files folder imageinclude (2 files)
Files folder imagelibrary (2 directories)
Files folder imageusers (5 files)
Accessible without login Plain text file index.php Aux. Configuration script
Accessible without login Plain text file initial.php Aux. Auxiliary script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads  
 100%
Total:0
This week:0