Skip to content

Instantly share code, notes, and snippets.

@incubs
incubs / save ,update and delete OOP
Created January 19, 2017 15:45
oop data save, update and delete
///classes .....................
<?php
class saveusers
{
protected $name;
protected $message;
protected $password;
protected $id;
@incubs
incubs / data change
Last active January 10, 2017 07:51
data delete and update
// this is to show the data from database ,list page
//form list page
{
//echo "show";
$mysql = mysqli_connect('localhost', 'root', '', 'leapfrog');
$query = "select * from users";
$result = mysqli_query($mysql, $query);
//echo $result;
// while($row = mysqli_fetch_assoc($result)){
?>
<?php
//insert into database
// create save.php file and write this code there, submit from a from which has fields, [message, name, password]
$name = $_POST['name'];
$message = $_POST['message'];
$password = $_POST['password'];
$query = "insert into users (name, message, password ) VALUES( '$name', '" .$message ."', '$password')";
$query = "select * from users";
@incubs
incubs / foreachhh
Last active January 2, 2017 02:22
usingforeach
<?php if (isset($_POST)) { ?>
<div class="container">
<table class="table-condensed table-hover table-bordered" >
<tr>
<?php
if(!empty($_POST))
{
foreach ($_POST as $tablehead => $value) {
?>
<th> <?php
@incubs
incubs / implod
Created December 30, 2016 16:11
implode
<?php if (isset($_POST["table"])) { ?>
<div class="container">
<table class="table-condensed table-hover table-bordered" >
<tr>
<?php
if(!empty($_POST))
{?>
<th><?php echo implode('</th><th>', array_keys($_POST)); ?></th>
<?php }
?>
@incubs
incubs / table.php
Created December 30, 2016 02:55
Table
<?php
//echo '<pre>';
//print_r( $_POST);
//die;
?>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
@incubs
incubs / form.html
Created December 30, 2016 02:53
Form
<html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
@incubs
incubs / array.php
Created December 30, 2016 02:50
Array manipulation
<?php
//$array = [
// 'cycling',
// 'hiking',
// 'running'
//];
//
//
//$array = [