Featured post
-Write C program to find even and odd number using macro #include<stdio.h> #define number(n)((n%2==0)?1:0) int main() { int num; printf("enter any number"); scanf("%d",&num); if(number(num)) printf("number is even"); else printf("number is odd"); return 0; } ***************************Output*********************** amr@amrj-virtual-machine:~$ gccevenodd.c amr@samr-virtual-machine:~$ ./a.out enter any number 2 number is evensmj@amr-virtual-machine:~$
FirebaseFirestore CRUD with bootstrap How
- Get link
- X
- Other Apps
Here is an example of how to perform a CRUD operation using the Firebase PHP library and Bootstrap:
- First, you will need to install the Firebase PHP library by running the following command
- composer require kreait/firebase-php
- Create a form in Bootstrap to add a new document to a Firestore collection. You can use Bootstrap's form classes to style the form and JavaScript to submit the form data to the PHP script.
<form id="add-form">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" placeholder="Enter name">
</div>
<div class="form-group">
<label for="age">Age</label>
<input type="number" class="form-control" id="age" placeholder="Enter age">
</div>
<button type="submit" class="btn btn-primary">Add</button>
</form>
<script>
// Add form submit event listener
document.getElementById("add-form").addEventListener("submit", function(event) {
event.preventDefault();
// Get form values
var name = document.getElementById("name").value;
var age = document.getElementById("age").value;
// Send form data to PHP script
fetch("add.php", {
method: "POST",
body: JSON.stringify({ name: name, age: age })
})
.then(response => response.json())
.then(data => {
// Handle response from PHP script
});
});
</script>
- Create a PHP script (add.php) to handle the form submission and add the data to Firestore:
require __DIR__ . '/vendor/autoload.php';
use Kreait\Firebase\Factory;
use Kreait\Firebase\ServiceAccount;
$serviceAccount = ServiceAccount::fromJsonFile(__DIR__ . '/path/to/service-account.json');
$firebase = (new Factory)
->withServiceAccount($serviceAccount)
->createFirestore();
$data = json_decode(file_get_contents("php://input"), true);
$docRef = $firebase->collection('users')->newDocument();
$docRef->create([
'name' => $data['name'],
'age' => $data['age']
]);
Similarly, you can create Bootstrap forms and PHP scripts to handle reading, updating and deleting data from Firestore using the Firebase PHP library.
Make sure to include bootstrap CSS and JS in the HTML file where you are trying to render the forms.
Note that the above examples are simplified and may not include error handling or other necessary details for a production application. Also you need to make sure to have the correct credentials and permissions to perform the CRUD operations in your Firestore database
- Get link
- X
- Other Apps
Popular posts from this blog
-Write C program to find even and odd number using macro
-Write C program to find even and odd number using macro #include<stdio.h> #define number(n)((n%2==0)?1:0) int main() { int num; printf("enter any number"); scanf("%d",&num); if(number(num)) printf("number is even"); else printf("number is odd"); return 0; } ***************************Output*********************** amr@amrj-virtual-machine:~$ gccevenodd.c amr@samr-virtual-machine:~$ ./a.out enter any number 2 number is evensmj@amr-virtual-machine:~$
BCA (SCIENCE) JAVA PRACTICAL SLIPS PAGES.(JAVA) UNIVERSITY OF PUNE
UNIVERSITY OF PUNE BCA (SCIENCE) JAVA PRACTICAL SLIPS PAGES. BCA (SCIENCE) JAVA PRACTICAL SLIPS PAGES.(JAVA) // slip 1. Q1 //Find max element of an array// import java.io.*; class slip1_1 { public static void main(String ar[])throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int max,i,n; int a[]=new int[10]; System.out.print("enter a how many element you want= "); n=Integer.parseInt(br.readLine()); for(i=0;i<n;i++) { System.out.print("enter a element = "); a[i]=Integer.parseInt(br.readLine()); } max=a[0]; for(i=0;i<n;i++) { if(max<a[i]) { max=a[i]; } } System.out.println("\nTHE MAX ELEMENT IS= "+max); } } /*================OUTPUT=============== smj@smj-virtual-machine:~$ javac Max.java smj@smj-virtual-machine:~$ java Max enter a how many element you want= 4 enter a element = 12 enter a element = 3 enter a element = 24 enter a element = 54 THE MAX ELEMENT IS= 54 sm...
How to OCR Text Extraction in Flutter Using Google ML Kit
Optical Character Recognition (OCR) is a powerful tool that enables apps to recognize and extract text from images. In this article, I'll walk you through how to implement OCR in a Flutter application using Google ML Kit. This can be particularly useful for creating document scanners, digitizing handwritten notes, or even converting printed text into digital form In this article, we will learn to recognize text from camera in Flutter. Text Recognition: This feature enables the identification of text from images or real-time camera input. The ML Kit Text Recognition API is capable of recognizing text in any Latin-based character set. For further details on Text Recognition, please refer to Google ML Kit's documentation. Using ML Kit for Text Recognition in Flutter For text recognition in Flutter, we are going to use the following Flutter plugins: google_ml_kit and camera. google_ml_kit: This plugin is used for text recognition and many other features. For more details, please...
Comments
Post a Comment
Welcome to FlutterForge please write your Query