Skip to content

Commit

Permalink
Changes Added
Browse files Browse the repository at this point in the history
  • Loading branch information
parvez-techforing committed Jan 20, 2023
1 parent eadf88f commit deec57d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 23 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,20 @@ This project provides updates, symptoms, prevention, and emergency response to t
4. MySQL (Database)
5. [Covid-19 API](https://api.covid19api.com/summary)

## How to SetUp this Project on Your Local Machine :
1. Clone this repo on your local machine using `git clone https://github.com/ruhulaminparvez/Covid-19-Tracker.git`
2. Create a database named `db_corona` in your phpmyadmin (MySQL Database).
3. Create a table named `case-corona` in your `db_corona` database with 6 columns (id, username, email, number, syndromes,description).
- id (int, 255, AI, PK)
- username (varchar, 255)
- email (varchar, 255)
- number (varchar, 255)
- syndromes (varchar, 255)
- description (varchar, 255)

4. Run the project on your local server (XAMPP, WAMPP, etc.)



## Bugs 😒
> If you run into any issues or have questions, ideas or concerns. Please enjoy and feel free to share your opinion, constructive criticism, or comments about my work. Feel free to email me at [email protected], Thank you!😊
13 changes: 7 additions & 6 deletions dbcon.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
<?php

$link = mysqli_connect("localhost", "root", "root", "dbcorona");
$link = mysqli_connect("localhost", "root", "", "db_corona");

// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}

if(isset($_POST['submit'])){
$name = mysqli_real_escape_string($link, $_REQUEST['username']);
$username = mysqli_real_escape_string($link, $_REQUEST['username']);
$email = mysqli_real_escape_string($link, $_REQUEST['email']);
$number = mysqli_real_escape_string($link, $_REQUEST['number']);
$stymtoms = ($_REQUEST['coronasym']);
$desc = mysqli_real_escape_string($link, $_REQUEST['desc']);
$description = mysqli_real_escape_string($link, $_REQUEST['description']);
$syndromes = $_POST['coronasym'];

$chk = "";

foreach($stymtoms as $chk1){
foreach($syndromes as $chk1){
$chk .= $chk1.",";
}
}


// Attempt insert query execution
$sql = "INSERT INTO `casecorona`(`username`, `email`, `mobile`, `stymtoms`, `description`) VALUES ('$name', '$email', '$number', '$chk', '$desc')";
$sql = "INSERT INTO `case-corona`(`username`, `email`, `number`, `syndromes`, `description`) VALUES ('$username', '$email', '$number', '$chk', '$description')";
if(mysqli_query($link, $sql)){
?>
<script>
Expand Down
26 changes: 11 additions & 15 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<?php include 'link/links.php'; ?>
<?php include 'css/style.php'; ?>
<?php include 'dbcon.php'; ?>
<?php include 'logic.php'; ?>
<?php include 'logic/logic.php'; ?>

</head>
<body onload="fetch()">
Expand Down Expand Up @@ -303,31 +303,27 @@

<div class="form-group">
<label>Select Symptoms</label><br>
<div class="custom-control custom-checkbox custom-control-inline text-capitalize">
<input type="checkbox" class="custom-control-input" id="customcheckbox1" name="coronasym[]" value="cold">
<label for="customcheckbox1" class="custom-control-label">Cold</label>
<div class="custom-control custom-checkbox custom-control-inline text-capitalize">
<input type="checkbox" class="custom-control-input" id="customcheckbox1" name="coronasym[]" value="cold">
<label class="custom-control-label" for="customcheckbox1">Cold</label>
</div>

<div class="custom-control custom-checkbox custom-control-inline text-capitalize">
<input type="checkbox" class="custom-control-input" id="customcheckbox2" name="coronasym[]" value="fever">
<label for="customcheckbox2" class="custom-control-label">Fever</label>
<input type="checkbox" class="custom-control-input" id="customcheckbox2" name="coronasym[]" value="fever">
<label class="custom-control-label" for="customcheckbox2">Fever</label>
</div>

<div class="custom-control custom-checkbox custom-control-inline text-capitalize">
<input type="checkbox" class="custom-control-input" id="customcheckbox3" name="coronasym[]" value="breath">
<label for="customcheckbox3" class="custom-control-label"> Difficulty Breath</label>
<input type="checkbox" class="custom-control-input" id="customcheckbox3" name="coronasym[]" value="breath">
<label class="custom-control-label" for="customcheckbox3">Difficulty in Breath</label>
</div>

<div class="custom-control custom-checkbox custom-control-inline text-capitalize">
<input type="checkbox" class="custom-control-input" id="customcheckbox4" name="coronasym[]" value="weak">
<label for="customcheckbox4" class="custom-control-label">Feeling Weak</label>
<input type="checkbox" class="custom-control-input" id="customcheckbox4" name="coronasym[]" value="tired">
<label class="custom-control-label" for="customcheckbox4">Feeling Weak</label>
</div>
</div>


<div class="form-group">
<label >Describe Briefly</label>
<textarea class="form-control" name="desc" id="exampleFormControlTextarea1" rows="3"></textarea>
<textarea class="form-control" name="description" id="exampleFormControlTextarea1" rows="3"></textarea>
</div>

<button type="submit" class="btn btn-primary" name="submit">Submit</button>
Expand Down
4 changes: 2 additions & 2 deletions logic/logic.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$data = file_get_contents("https://api.covid19api.com/summary");
$coronaData = json_decode($data);

echo "<pre>";
print_r($coronaData);
// echo "<pre>";
// print_r($coronaData);

?>

0 comments on commit deec57d

Please sign in to comment.