Posts

Showing posts from July, 2021

Replace and update in mysql query

Image
 Table Name=packers Column=contactNo 8964828952, 8964828951 8964828952, 8964828951 want to replace every    8964828952 to  9109595911 from contctNo column UPDATE   packers   SET   contactNo   =   REPLACE ( contactNo ,   '8964828952' ,   '9109595911' )

Number OR Amount to Word Conversion in php

Image
function getIndianCurrency(float $number) { $decimal = round($number - ($no = floor($number)), 2) * 100; $hundred = null; $digits_length = strlen($no); $i = 0; $str = array(); $words = array(0 => '', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine', 10 => 'ten', 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 14 => 'fourteen', 15 => 'fifteen', 16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen', 19 => 'nineteen', 20 => 'twenty', 30 => 'thirty', 40 => 'forty', 50 => 'fifty', 60 => 'sixty', 70 => 'seventy', 80 => 'eighty', 90 => 'nine...

Get selected value from react js functional component

Image
  // App.js import React, { useState } from "react"; import { Dropdown, Option } from "./Dropdown"; export default function App() {   const [optionValue, setOptionValue] = useState("");   const handleSelect = (e) => {     console.log(e.target.value);     setOptionValue(e.target.value);   };   return (     <div>       <h1>Which service are you interested in?</h1>       <Dropdown         formLabel="Choose a service"         buttonText="Send form"         onChange={handleSelect}         action="https://jsonplaceholder.typicode.com/posts"       >         <Option selected value="Click to see options" />         <Option value="Option 1" />         <Option value="Option 2" />         <Option...

PHP age calculator according to DOB

Image
$dob="10-10-2000";  if(!empty($dob)){                             $birthdate = new DateTime($dob);                             $today   = new DateTime('today');                             $age = $birthdate->diff($today)->y;                         }else{                           $age=0;                                                     }

Codeigniter Inner Join Example

Image
public function funcname ( $id ) { $this ->db->select( '*' ); $this ->db->from( 'Album a' ); $this ->db->join( 'Category b' , 'b.cat_id=a.cat_id' , 'left' ); $this ->db->join( 'Soundtrack c' , 'c.album_id=a.album_id' , 'left' ); $this ->db->where( 'c.album_id' , $id ); $this ->db->order_by( 'c.track_title' , 'asc' ); $query = $this ->db->get(); if ( $query ->num_rows() != 0 ) { return $query ->result_array(); } else { return false ; } }