Insert data into mysql table in php using mysqli method

Create File first.php using form

<style>
    input{
        display: block;
    }
    </style>
    <form method="post" action="second.php" enctype="multipart/form-data">
<input type="text" name="user_name">
<input type="password" name="user_password">

Male <input type="radio" name="gender" value="male" checked>
Female <input type="radio" name="gender" value="female">

<input type="checkbox" name="car" value="Maruti"> Car 
<input type="checkbox" name="house" value="Narela"> House 
<input type="checkbox" name="bike" value="Bajaj"> Bike 

<input type="file" name="image[]" multiple>

<input type="submit" value="Click" name="click">
</form>

Create file second.php to insert data into table

this example show only two fields, you can add more field in php code to insert.

<?php
$host="localhost";
$user="root";
$password="";
$database="pankaj";


$link= mysqli_connect($host, $user, $password, $database);
if(!$link)
{
    echo "Not Connected".mysqli_error($link);
    die();
}

$user_name=$_POST['user_name'];
$user_Password=$_POST['user_password'];

$cmd="insert into user  set user_name='$user_name', user_password='$user_Password'";
if(mysqli_query($link, $cmd))
{
 echo "Success";   
}
else
{
    echo "User Already Exists";//mysqli_error($link);
}




?>


Multiple File Upload Example In PHP

1. Create file first.php

<style>
    input{
        display: block;
    }
    </style>
    <form method="post" action="second.php" enctype="multipart/form-data">
<input type="text" name="user_name">
<input type="password" name="user_password">

Male <input type="radio" name="gender" value="male" checked>
Female <input type="radio" name="gender" value="female">

<input type="checkbox" name="car" value="Maruti"> Car 
<input type="checkbox" name="house" value="Narela"> House 
<input type="checkbox" name="bike" value="Bajaj"> Bike 

<input type="file" name="image[]" multiple>

<input type="submit" value="Click" name="click">
</form>

2. Create file second.php

<?php

$i=0;
foreach($_FILES['image']['name'] as $file => $name)
{
  echo $_FILES['image']["tmp_name"][$file]."<br>";
  echo $_FILES['image']["name"][$file]."<br>";
  echo $_FILES['image']["type"][$file]."<br>";
  echo $_FILES['image']["size"][$file]."<br>";
   
   $ext=pathinfo(basename($_FILES["image"]["name"][$file]), PATHINFO_EXTENSION);

$target_file="./profile".$i.".".$ext;
$i++;
   
   move_uploaded_file($_FILES["image"]["tmp_name"][$file], $target_file);
}

echo "total file ".count($_FILES['image']['name']);
?>

Below code show example for check file size, file extension, file type for uploading valid file

<?php
print_r($_POST);
echo "<br>";
print_r($_FILES);

echo "<br>File Name : ".$_FILES['image']['name']."<br>";
echo "File Type : ".$_FILES['image']['type']."<br>";
echo "File Temp Name  : ".$_FILES['image']['tmp_name']."<br>";
echo "File Size : in bytes ".$_FILES['image']['size']."<br>";
$file=$_FILES['image']['size'] / 1024;
echo "File Size : in KB ".number_format($file, 2)."<br>";
$file=$file / 1024;

echo "File Size : in MB ".number_format($file, 2)."<br>";
echo "File Error : ".$_FILES['image']['error']."<br>";


$ext=pathinfo(basename($_FILES["image"]["name"]), PATHINFO_EXTENSION);
$filename=time();
$target_file="./".$filename.".".$ext;

move_uploaded_file($_FILES["image"]["tmp_name"], $target_file);

?>

Numbers of Zeros in a Million, Billion, Trillion

Numbers Bigger Than a Trillion

The digit zero plays an important role as you count very large numbers. It helps track these multiples of 10 because the larger the number is, the more zeroes are needed. In the table below, the first column lists the name of the number, the second provides the number of zeros that follow the initial digit, and the third tells you how many groups of three zeros you would need to write out each number.

NameNumber of ZerosGroups of (3) Zeros
Ten1(10)
Hundred2(100)
Thousand31 (1,000)
Ten thousand4(10,000)
Hundred thousand5(100,000)
Million62 (1,000,000)
Billion93 (1,000,000,000)
Trillion124 (1,000,000,000,000)
Quadrillion155
Quintillion186
Sextillion217
Septillion248
Octillion279
Nonillion3010
Decillion3311
Undecillion3612
Duodecillion3913
Tredecillion4214
Quatttuor-decillion4515
Quindecillion4816
Sexdecillion5117
Septen-decillion5418
Octodecillion5719
Novemdecillion6020
Vigintillion6321
Centillion303101

All of Those Zeroes

A table like the one above can certainly be helpful in listing the names of all of the numbers depending on how many zeros they have. But it can be really mind-boggling to see just what some of those numbers look like. Below is a listing—including all the zeros—for the numbers up to decillion—a little more than just half the numbers listed in the above table.

Ten: 10 (1 zero)
Hundred: 100 (2 zeros)
Thousand: 1000 (3 zeros)
Ten thousand 10,000 (4 zeros)
Hundred thousand 100,000 (5 zeros)
Million 1,000,000 (6 zeros)
Billion 1,000,000,000 (9 zeros)
Trillion 1,000,000,000,000 (12 zeros)
Quadrillion 1,000,000,000,000,000 (15 zeros)
Quintillion 1,000,000,000,000,000,000 (18 zeros)
Sextillion 1,000,000,000,000,000,000,000 (21 zeros)
Septillion 1,000,000,000,000,000,000,000,000 (24 zeros)
Octillion 1,000,000,000,000,000,000,000,000,000 (27 zeros)
Nonillion 1,000,000,000,000,000,000,000,000,000,000 (30 zeros)
Decillion 1,000,000,000,000,000,000,000,000,000,000,000 (33 zeros)

Zeros Grouped in Sets of 3

Reference to sets of zeros is reserved for groupings of three zeros, meaning they are not relevant for smaller numbers. We write numbers with commas separating sets of three zeros so that it’s easier to read and understand the value. For example, you write one million as 1,000,000 rather than 1000000.

As another example, it’s much easier to remember that a trillion is written with four sets of three zeros than it is to count out 12 separate zeroes. While you might think that that one is pretty simple, just wait until you have to count 27 zeros for an octillion or 303 zeros for a centillion.

It is then that you will be thankful that you only have to remember nine and 101 sets of zeros, respectively.

Numbers With Very Large Numbers of Zeros

The number googol (termed by Milton Sirotta) has 100 zeros after it. Here’s what a googol looks like, including all of its required zeros:

10,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000

Do you think that number is big? How about the googolplex, which is a one followed by a googol of zeros. The googolplex is so large it doesn’t have any meaningful use yet—it is larger than the number of atoms in the universe.

Million and Billion: Some Differences

In the United States—as well as around the world in science and finance—a billion is 1,000 million, which is written as a one followed by nine zeros. This is also called the “short scale.”

There is also a “long scale,” which is used in France and was previously used in the United Kingdom, in which a billion means one million million. According to this definition of a billion, the number is written with a one followed by 12 zeros. The short scale and long scale were described by French mathematician Genevieve Guitel in 1975.

How create playlist in YouTube applications

You can either start a playlist with a video, or from the Library tab  .

With a video:

  1. Find a video you want in your playlist.
  2. Tap Save  below the video to automatically save it to the last playlist you’ve saved to, or to your Watch Later playlist. A message will pop up at the bottom of your screen confirming which playlist the video was added to.
  3. To change where your video is saved, tap Change on the pop up. Select from the list of your playlists where your video should be saved. 

From the Library tab:

  1. Go to the Library tab  .
  2. Tap NEW PLAYLIST in the “Playlists” section.
  3. Select one or more videos from your recent watch history to add to the playlist.
  4. Tap NEXT.
  5. Give your playlist a title and set its privacy.
  6. Tap CREATE.

how to check my laravel version

There are two ways available to find the version of the Laravel application. You can either find it by running a command or you can check the Laravel version in files.

Command to find Laravel Version

Open the terminal on your system. Navigate to the webroot directory of the Laravel application. Now execute the following PHP artisan command to check the Laravel version.

$ php artisan --version

Laravel Framework 5.6.39

Check Laravel Version in File

Sometimes you may not have access to the terminal of server-hosted Laravel application. Or you may not much familiar with the command line. In that case, you can simply view the Laravel version in the following file.

First navigation to Laravel webroot directory.

$ vim ./vendor/laravel/framework/src/Illuminate/Foundation/Application.php

Linked List In CPP

#include<iostream>
#include<conio.h>
#include<stdio.h>
#include<ctype.h>
using namespace std;
class node
{
int data;
node*next;
public:
node *creatlist()
{
node*head,*tail, *temp;
int x;
head=NULL;
cout<<"Enter number(-99 to stop):";
cin>>x;
while(x!=-99)
{
temp=new node();
temp->data=x;
temp->next=NULL;
if(head==NULL)
{
head=tail=temp;
}
else
{
tail->next=temp;
tail=temp;
}
cout<<"enter value(-99 to stop)";
cin>>x;
}
return head;
}

void traverse(node*head)
{
node*p=head;
while(p!=NULL)
{
cout<<p->data<<"->";
p=p->next;
}
cout<<"\b"<<char(12)<<endl;
}

void searchnode(node*head,int srch)
{

node*p=head;
while(p!=NULL)
{

if(srch==p->data)
{

cout<<endl<<p->data<<" found\n";
{

break;
}
}
p=p->next;
}

if(p==NULL)
{
cout<<"\nnot found\n";
}

}



node *inserthead(node*head,int x)
{
node *tmp;
if(head==NULL)
{
cout<<"empty list";
}
else
{
tmp=new node();
tmp->data=x;
tmp->next=head;
head=tmp;
}
return head;
}
node *deletehead(node*head)
{
     
node*p=head;
if(head==NULL)
{
cout<<"empty list";
}
else
{
 head=p->next;
 delete(p);
 }
 return head;
}
node* inserttail(node*head,int x)
{
      node *tmp;
node*p=head;
if(head==NULL)
{
              cout<<"empty list";
              }
              else
              {
while(p->next!=NULL)
{
p=p->next;
}
tmp=new node();
tmp->data=x;
tmp->next=NULL;
p->next=tmp;
}

return head;
}
node*deletebefore(node*head,int srch)
{
node *p,*q;
p=head;
q=head->next;
while(q!=NULL)
{
if(q->next->data==srch)
{
break;
}
p=p->next; q=q->next;
}
if(q!=NULL)
{
p->next=q->next;
delete(q);
}
else
{
cout<<"Delete error";
}
return head;
}

};
int main()
{
int ch,srch,x;
char cnt;
node singly;
node*head;
do{
cout<<"1.for creatlist"<<endl<<"2.for traverse"<<endl<<"3.for search"<<endl<<"4. head insert"<<endl<<"5.delete head"<<endl<<"6.for insert tail"<<endl<<"7 for deletebefore"<<endl;
cout<<"enter your choice\n";
cin>>ch;

if(ch==1)
{
head=singly.creatlist();
}
else if(ch==2)
{
singly.traverse(head);
}
else if(ch==3)
{
cout<<"enter srch value";
cin>>srch;
singly.searchnode(head,srch);	
}
else if(ch==4)
{
cout<<"enter value for insert ";
cin>>x;
head=singly.inserthead(head,x);	
}
else if(ch==5)
{
cout<<"delete head";
head=singly.deletehead(head);

}
else if(ch==6)
{
     cout<<"insert new value for tail : ";
     cin>>x;
     head=singly.inserttail(head,x);
 }
 else if(ch==7)
 {
 cout<<"enter srch value";
 cin>>srch;

 head=singly.deletebefore(head,srch);
}
fflush(stdin);
cout<<"do you want to continue then press (y/n) : ";
cin>>cnt;
}
while(toupper(cnt)=='Y');


getch();
}

What is Linked List

List of Program of C language

  1. WAP to ADD, Sum, MUL, Divide of two numbers X, Y?
  2. WAP to enter five nos. and print sum and average?
  3. WAP to enter Principle, Rate, Time and calculate Simple Interest?
  4. WAP to enter basic and calculate hra 2% of basic, da 3%of basic and find gross salary?
  5. WAP to exchange value of two Variables of Two Values X, Y?
  6. WAP to print prime or not prime numbers?
  7. WAP to print even or odd numbers?
  8. WAP to reverse numbers?
  9. WAP of factorial numbers?
  10. WAP of Fibonacci series?
  11. WAP fine the largest numbers in array?
  12. WAP sum of two matrix?
  13. WAP Mul of two Matrix?
  14. WAP print reverse order of array?
  15. WAP of array implementation of queue?
  16. WAP array of pointer?
  17. WAP array of structure?
  18. WAP of automatic storage class?
  19. WAP of Binary Search?
  20. WAP of Bubble sort, insertion sort and selection sort?
  21. WAP of Call by value and Call by reference?
  22. WAP of stack using array?
  23. WAP of stack using linked list?
  24. WAP of Merging of two  D array?
  25. WAP of Transpose of Two D Array?
  26. WAP of recursive function?
  27. WAP of Singly linked list in C with using structure?
  28. WAP of smallest and largest number in 2 D Array?
  29. WAP of Negative and positive number ?
  30. WAP to display largest of from three inputs?
  31. WAP of Looping statement
  32. For Loop
  33. While loop
  34. Do while loop

Using these loop make a program of even and odd number, prime and not prime numbers, negative and positive numbers etc.

  • WAP of loop control statement

(a)Break

(b)continue

(c ) exit(0)

(d)goto

Using these loop control statement write a program of prime or not prime numbers and even and odd number etc.

  • WAP of Linear Search?
  • WAP of Binary search?
  • WAP of insert,search and delete in Array?
  • WAP of string create a string count the words of string and reverse the string?
  • WAP search the string?
  • WAP matrix add calculating with 2 D Array
  • Row major ording
  • Coolum Major ordering
  • WAP of file handling with file oprations

(a)Read

(b)Write

(c )append

(d)read/write

37. WAP enter two string copy one string to another string?

38. WAP to enter the string and count word and space in string?

39. WAP to convert decimal to binary number?

40. WAP to print their value in decreasing order?

41.WAP to enter string convert lower alpha to upper alpha?

42. WAP to sort the character in the string

Input-> COMPU

OUTPUT->CMOPU

43. WAP to remove space from string?

44.WAP of Sparse Matrix?

45.WAP display name, roll, marks, t.makrs, sub, hindi, eng, sci, math  using string in array?

46.WAP display name, desi, contact etc. in string?

47. WAP to compare to string equal or not?

48. WAP find the sum of prime numbers 2-100?

49. WAP to enter two numbers and swap their values

50. WAP to the enter the user want at the end it should display the count the positive, negative and zero

51.WAP to digit wise reverse

52. WAP to digit wise multiply

53 WAP to digit wise reverse and add 5 with it.

54. WAP to print count digit numbers

55. WAF create a factorial of number with return argument

56. WAF of prime and not prime numbers

57 WAF of stack

58 WAF to enter the n number print their sum of total numbers

59 WAP of deep copying and shallow coping

60 WAP array of pointer

61.WAP to show the contents of pointer an array of pointer

62. WAP of pointer with pointer

63 WAP of two point p1 and p2

 Int  i=10,j=20; compare tow pointers

64. WAP to exchange two integer values using function in pointer

65. WAP to find the sum of all element stored in array

Int *p, sum=0, I;

Int A[3]={4,5,6}

66. WAP to return largest value in pointer

67.  WAP 2D Array elements using pointer?

68. WAP of structure pointer

69. WAP of Nested Structure

70. WAP of Singly linked through structure in C

71. WAP of Doubly linked list through structure in C

72. WAP of Circular linked list through structure in C

73. WAP of implementation stack using linked list in C

74. WAP to store even values in another link list

75. WAP of recursive to display the nodes of linked list

76. WAP of stack using array and linked list.

Singly linked list in c language

#include<stdio.h>
#include<process.h>
struct node
{
	int data;
	struct node *next;
};
typedef struct node *singly;
singly createlist()
{
	int x;
	singly head,tail,tmp;
	head=NULL;
	printf("\n enter value(-99 to stop)");
	scanf("%d",&x);
	while(x!=-99)
	{
		tmp=(singly)malloc(sizeof(struct node));
		tmp->data=x;
		if(head==NULL)
		{
			head=tail=tmp;
		}
		else
		{
			tail->next=tmp;
			tail=tmp;
		}
		tail->next=NULL;
		printf("\n Enter value(-99 to stop)");
		scanf("%d", &x);
			}
			return(head);
}
void traverse(singly head)
{
	singly p=head;
	while(p!=NULL)
	{
		printf("%d --> ",p->data);
		p=p->next;
	}
}
singly inserthead(singly head,int ins)
	{
		singly tmp;
		tmp=(singly)malloc(sizeof(struct node));
		tmp->data=ins;
		if(head==NULL)
		{
			printf("\n error insert");
		}
		else
		{
			tmp->next=head;
			head=tmp;
		}
		return(head);
}
singly insertbefore(singly head, int srch,int ins)
{
	singly p=head,tmp;
	while(p!=NULL)
	{	if(p->next->data==srch)
		{
			break;
		}
		p=p->next;
	}
	if(p!=NULL)
	{
		tmp=(singly)malloc(sizeof(struct node));
	
		tmp->data=ins;
		tmp->next=p->next;
		p->next=tmp;
		
	}
	else
	{
		printf("\n error insert");
	}
	return(head);
}
singly deletetail(singly head)
{
	singly p=head,q=head->next;
	while(q->next!=NULL)
	{
		p=p->next;
		q=q->next;
	}
	p->next=NULL;
	free(q);
	return(head);
}
singly deleteafter(singly head,int srch)
{
	singly p=head,q=head->next;
	while(p->next!=NULL)
	{
		if(p->data==srch)
		{
			break;
		}
		p=p->next;q=q->next;
	}
	if(p->next==NULL)
	{
		printf("\n delete error");
	}
	else
	{
		p->next=q->next;
		free(q);
	}
	return(head);
}


int main()
{
	singly head;int ch,ins;char cnt;int srch;

	do{
		printf("\n1. create list\n2. traverse\n3. insert as head\n4. insert before\n5. Delete tail\n6. Delete after\nEnter your choice : ");
	scanf("%d",&ch);
	switch(ch){
		case 1:
	head=createlist();
		break;
		case 2:
	traverse(head);
		break;
		case 3:
		printf("\nenter value to insert : ");
		scanf("%d",&ins);
	head=inserthead(head,ins)	;
		break;
		case 4:
		printf("\n enter value to insert :");
		scanf("%d",&ins);
		printf("\n enter value to search :");
		scanf("%d",&srch);
	head=insertbefore(head,srch,ins)	;
		break;
		case 5:
	head=deletetail(head);
		break;
		case 6:
		printf("\n enter value to search");
		scanf("%d",&srch);
		head=deleteafter(head,srch) ;
		break;	
	}
	fflush(stdin);
	printf("\ndo you want to continue (y/n) : ");
	scanf("%c",&cnt);
	}while(cnt=='y');
}

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
     style="display:block"
     data-ad-format="autorelaxed"
     data-ad-client="ca-pub-7462577112023113"
     data-ad-slot="1814817697"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>

upload image ajax

Ajax code for image upload

$(document).ready(function (e) {
    $('#imageUploadForm').on('submit',(function(e) {
        e.preventDefault();
        var formData = new FormData(this);

        $.ajax({
            type:'POST',
            url: $(this).attr('action'),
            data:formData,
            cache:false,
            contentType: false,
            processData: false,
            success:function(data){
                console.log("success");
                console.log(data);
            },
            error: function(data){
                console.log("error");
                console.log(data);
            }
        });
    }));

    $("#ImageBrowse").on("change", function() {
        $("#imageUploadForm").submit();
    });
});

Basic Php Code for File Upload

$filetype = array('jpeg','jpg','png','gif','PNG','JPEG','JPG');
   foreach ($_FILES as $key )
    {

          $name =time().$key['name'];

          $path='local_cdn/'.$name;
          $file_ext =  pathinfo($name, PATHINFO_EXTENSION);
          if(in_array(strtolower($file_ext), $filetype))
          {
            if($key['name']<1000000)
            {

             @move_uploaded_file($key['tmp_name'],$path);
             echo $name;

            }
           else
           {
               echo "FILE_SIZE_ERROR";
           }
        }
        else
        {
            echo "FILE_TYPE_ERROR";
        }

श्र से शब्द