-2

Okay I had a bit of a problem yesterday, but I could solve it. Now I'll get the error line mentioned in the title. But I honestly don't know why mysqli is unexpected. Can you help me?

<html>
<head>
<title>Vanille</title>
</head>
<body>
<?php
include realhtmlinphpfile.php
mysqli_connect("localhost")
or die ("Fehler");

mysqli_select_db("test34")
or die ("Verbindung nicht möglich..."); 

$Test1 = $_POST["Test1"]; 
$Test2 = $_POST["Test2"];
$Text3 = $_POST["Test3"]; 
$Test4 = $_POST["Test4"];

if($Test1 == "" or $Test2 == "" or $Test3 == "" or $Test4 == "") {
echo "FAIL";
} else {

$eintrag = "INSERT INTO test34
(datum, autor, newstext)

VALUES 
('$test1', '$test2', '$test3', '$test4')";

}

mysql_close($verbindung); 
?>
</body>                              
</html>
DarkYagami
  • 93
  • 7
  • you have forgot below things in your code : 1. include 'realhtmlinphpfile.php'; 2. Make proper db connection http://php.net/manual/en/function.mysqli-connect.php – Krishna Gupta Oct 30 '15 at 07:09

3 Answers3

1

Syntax error.

Correct

include realhtmlinphpfile.php

To

include 'realhtmlinphpfile.php';
Pupil
  • 23,834
  • 6
  • 44
  • 66
1

On the line previous you are missing the ;

Lima
  • 1,203
  • 3
  • 22
  • 51
1

Missing ; on here

include realhtmlinphpfile.php

Change that to this

include ("realhtmlinphpfile.php");

and proper mysqli_connect query is

$con = mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85