Jump to content
JorgeLuzz

Notice: Undefined index / Warning: mysqli_error() expects exactly 1 parameter, 0 given

Recommended Posts

JorgeLuzz
require('db.php');
include("auth.php");

$status = "";
if(isset($_POST['new']) && $_POST['new']==1)
{
$id=$_REQUEST['id'];
$date = $_REQUEST['data'];
$login_id =$_REQUEST['login_id'];
$submittedby = $_SESSION["username"];
$query="INSERT into 'clientes' ('id',`login_id`,`data`,'submittedby') values ('$id','$login_id','$date','$submittedby')";
$result = mysqli_query($con, $query) or die ( mysqli_error());
$row = mysqli_fetch_assoc($result);
$status = "Novo registo inserido com sucesso.</br></br><a href='view.php'>Ver Registos</a>";
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Inserir Registo</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<div class="form">
<p><a href="dashboard.php">Dashboard</a> | <a href="view.php">Ver Registos</a> | <a href="logout.php">Logout</a></p>

<div>
<h1>Insert New Record</h1>
<form name="form" method="post" action=""> 
<input type="hidden" name="new" value="1" />
<p><input type="text" name="id" placeholder="Numero de conta" obrigatorio /></p>
<p><input type="text" name="login" placeholder="Numero de conta" obrigatorio /></p>
<p><input type="text" name="date" placeholder="data" obrigatorio /></p>
<p><input name="submit" type="submit" value="Submit" /></p>
</form>
<p style="color:#FF0000;"><?php echo $status; ?></p>

<br /><br /><br /><br />

Gera um erro ao inserir na tabela

 

Notice: Undefined index: data in C:\xampp\htdocs\Gestao\insert.php on line 14

Notice: Undefined index: login_id in C:\xampp\htdocs\Gestao\insert.php on line 15

Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\Gestao\insert.php on line 18

 

Alguem me dá ajuda,

 

Cumprimentos


Cumprimentos Jorge Luz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.