-5

Hi, I'm currently trying to add data into my SQL table using php I can't seem to see where I'm going wrong here, I'm getting the following errors:

Notice: Undefined index: ModuleId in N:\ftp\compc\d11os\Project\addModule.php on line 70

Notice: Undefined index: Title in N:\ftp\compc\d11os\Project\addModule.php on line 70

Notice: Undefined index: CreditLevel in N:\ftp\compc\d11os\Project\addModule.php on line 70

Notice: Undefined index: CreditPoints in N:\ftp\compc\d11os\Project\addModule.php on line 70

Notice: Undefined index: Status in N:\ftp\compc\d11os\Project\addModule.php on line 70

Warning: mysql_query(): Access denied for user ''@'localhost' (using password: NO) in N:\ftp\compc\d11os\Project\addModule.php on line 72

Warning: mysql_query(): A link to the server could not be established in N:\ftp\compc\d11os\Project\addModule.php on line 72

Here is the code I'm currently using:

<?php 
if (isset($_POST['submit']) && $_POST['submit']=="Submit") {

$con=mysqli_connect("localhost","useername ","password ","databasename");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }


    $insert = "INSERT INTO module (ModuleId, Title, CreditLevel, CreditPoints, Status, Award)

    VALUES ('".$_POST['ModuleId']."','".$_POST['Title']."','".$_POST['CreditLevel']."','".$_POST['CreditPoints']."','".$_POST['Status']."','".$_POST['Award']."')";

    $add_member = mysql_query($insert);


 ?>

Can someone please help? :/

EM-Creations
  • 4,195
  • 4
  • 40
  • 56

1 Answers1

-1

You've used mysql_query() when you should be using mysqli_query() for a start.

EM-Creations
  • 4,195
  • 4
  • 40
  • 56