Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Abdul Rafay Modi AlphaRomeoMike

🎯
Focusing
View GitHub Profile
View edit_data.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="Description" content="Enter your description here" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
View add_data.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="Description" content="Enter your description here"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
<link rel="stylesheet" href="assets/css/style.css">
View crud_view.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="Description" content="Enter your description here"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
<link rel="stylesheet" href="assets/css/style.css">
View CrudModel.php
<?php
namespace App\Models;
use CodeIgniter\Model;
class CrudModel extends Model {
protected $table = 'tbl_users';
protected $primaryKey = 'id';
protected $allowedFields = ['name', 'email', 'gender'];
}
View Crud.php
<?php
namespace App\Controllers;
use App\Models\CrudModel;
class Crud extends BaseController {
//SELECT DATA
function index() {
// echo "Hello CI-4";
View Database.php
<?php namespace Config;
/**
* Database Configuration
*
* @package Config
*/
class Database extends \CodeIgniter\Database\Config
{
View home.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="Description" content="Enter your description here" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css">
View delete.php
<?php
require "connection.php";
$data = json_decode(file_get_contents("php://input"));
$id = $data->id;
$query = "CALL st_deleteUser($id)";
if(mysqli_query($con, $query)) {
$response["msg"] = "User deleted response from server was a success ";
} else {
View select.php
<?php
require "connection.php";
$query = "CALL st_getUser()";
$response = array();
$res = mysqli_query($con, $query);
if(mysqli_num_rows($res)) {
while($row = mysqli_fetch_assoc($res)) {
$response[] = $row;
View update.php
<?php
require "connection.php";
$data = json_decode(file_get_contents("php://input"));
$id = $data->id;
$name = $data->name;
$age = $data->age;
$phone = $data->phone;
$query = "CALL st_updateUser('$name', $age, '$phone', $id)";