Skip to content

Instantly share code, notes, and snippets.

View MahbbRah's full-sized avatar
🎯
Focusing

Mahbub Rahman MahbbRah

🎯
Focusing
  • Dinajpur, Bangladesh
View GitHub Profile
@MahbbRah
MahbbRah / search-result.php
Last active April 17, 2016 09:07
Actually, I'm trying to to create a search form for a personal website that have single search form and multiple DB fields. if data match with input value then that field or similar all fields will echo .
<?php
if(isset($_GET['submit_value']) && !empty($_GET['search_input']))
{
include("db_config.php");
$db = database::getInstance();
$searchValue = $_GET['search_input'];
$sql = "SELECT * FROM `sitedata` WHERE c_main_title LIKE '%$searchValue%' OR c_main_body LIKE '%$searchValue%' OR cmt_dept_title LIKE '%$searchValue%' OR cmt_dept_body LIKE '%$searchValue%'
OR aidt_dept_title LIKE '%$searchValue%' OR aidt_dept_body LIKE '%$searchValue%' OR food_dept_title LIKE '%$searchValue%' OR food_dept_body LIKE '%$searchValue%' OR rac_dept_title LIKE '%$searchValue%'
<?php foreach ($result as $row) {
$value1 = strpos($row['c_main_title'], $searchValue) !== FALSE;
$value2 = strpos($row['c_main_body'], $searchValue) !== FALSE;
$value3 = strpos($row['cmt_dept_title'], $searchValue) !== FALSE;
$value4 = strpos($row['cmt_dept_body'], $searchValue) !== FALSE;
$value5 = strpos($row['aidt_dept_title'], $searchValue) !== FALSE;
$value6 = strpos($row['aidt_dept_body'], $searchValue) !== FALSE;
$value7 = strpos($row['food_dept_title'], $searchValue) !== FALSE;
$value8 = strpos($row['food_dept_body'], $searchValue) !== FALSE;
$value9 = strpos($row['rac_dept_title'], $searchValue) !== FALSE;
@MahbbRah
MahbbRah / query.php
Created April 22, 2016 05:29
How to convert this in php query ?
<?php
SET @sql = NULL;
SELECT
GROUP_CONCAT(DISTINCT
CONCAT(
'max(CASE WHEN ca.date = ''',
date_format(date, '%Y-%m-%d'),
''' THEN coalesce(p.status, ''P'') END) AS `',
date_format(date, '%Y-%m-%d'), '`'
)
@MahbbRah
MahbbRah / addition.php
Created April 26, 2016 15:59
As you can see this is a working query. and now I want to add first and second field (int) value on 3rd field like $f_name + $m_name = value; with loop. how could i do that?
<?php
if(isset($_POST['Submit'])){
for($i=0;$i<$count;$i++){
$name = $_POST['name'];
$f_name = $_POST['lastname'];
$m_name = $_POST['email'];
// This is a query for uploading multiple values in single query.
$sql1="UPDATE computer SET s_name='$name[$i]', f_name='$f_name[$i]', m_name='$m_name[$i]' WHERE roll='$id[$i]'";
@MahbbRah
MahbbRah / query.php
Created April 26, 2016 16:02
multiple value update in single query
<?php
ob_start();
include('../db_config.php');
$db = database::getInstance();
$sql = "SELECT * FROM computer";
$result = $db->dbc->query($sql);
$count = $result->rowCount();
?>
@MahbbRah
MahbbRah / multiple-insert.php
Created July 26, 2016 02:32
multiple insert in single submission
<?php
ob_start();
include('../db_config.php');
$db = database::getInstance();
$sql = "SELECT * FROM computer";
$result = $db->dbc->query($sql);
$count = $result->rowCount();
?>
@MahbbRah
MahbbRah / js.md
Created August 25, 2017 13:59 — forked from nuhil/js.md
Javascript Handbook

Javascript Handbook

A hand crafted markdown document contains all major Javascript topics covered, taken from different sources. Brush Up your JS memory.

Comments


Single line comments start with //. For multi-line commands, you use /* ... */

// This is a single line comment
@MahbbRah
MahbbRah / install babel for ES6
Created October 11, 2017 05:32
Install babel for ES6 on clean & fresh project
# install babel with npm or yarn
`npm install --save-dev babel-cli`
=> add a script on `package.json` for babel with this line: `babel-node FILENAME_TO_SERVE`
=> install babel ES6 presets `npm install --save-dev babel-preset-es2015`
=> add es6 presets to `.babelrc` file `{ "presets": ["es2015"] }`
#And there we go!
@MahbbRah
MahbbRah / Docker Note
Last active September 19, 2018 17:03
Notes on using Docker [Step by Step]
#Docker Installation:
First, add the GPG key for the official Docker repository to the system:
`curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -`
`sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"`
`sudo apt-get update`
Make sure you are about to install from the Docker repo instead of the default Ubuntu 16.04 repo:
`apt-cache policy docker-ce`
@MahbbRah
MahbbRah / doctorAchenLogin.html
Last active October 15, 2018 05:54
AccountKit Implementation (Live) for Doctor Achen.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge, chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, minimum-scale=1">
<title>Accountkit</title>
</head>
<body>