Fatal error: Uncaught mysqli_sql_exception: Unknown column in 'field list' (PHP) [duplicate] - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Saturday, March 12, 2022

Fatal error: Uncaught mysqli_sql_exception: Unknown column in 'field list' (PHP) [duplicate]

This is for you so that you can understand. I am working on a signup page in HTML. When you submit it, it gets the data from the form and inserts that data into a database. This is done with PHP by the way. When I submit it, it shows the above error: Fatal error: Uncaught mysqli_sql_exception: Unknown column '' in 'field list' in Stack trace: #0 : mysqli_query(Object(mysqli), 'INSERT INTO `ta...') #1 {main} thrown in . What I see it is doing is that it is getting the data from the HTML file and deciding that is the name of the column.

PHP code:

<?php
    $servername = "***";
$username = "******";
$password = "*****";
$dbname = "*******";
$name = $_GET["username"];
$skool = $_GET["skool"];
$email = $_GET["email"];
$pwd = $_GET["password"];  
echo "Welcome, $name";
$hashed = password_hash("$pwd", PASSWORD_DEFAULT);
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}

$sqli = "INSERT INTO `table` (`School`, `Email Address`, `Password`, `Username`)
VALUES (`$skool`, `$email`, `$hashed`, `$name`)";


if(mysqli_query($conn, $sqli)){
    echo "Records inserted successfully.";
} else{
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($conn);
}
?>

I have tried many other stack questions. DIDINT WORK! How do i fix this?

fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff



source https://stackoverflow.com/questions/71443168/fatal-error-uncaught-mysqli-sql-exception-unknown-column-in-field-list-php

No comments:

Post a Comment