Practising writing to phpmyadmin but although connected nothing is ever inserted

EDIT

Not sure how to delete post so just to let you know before reading this (save your energy) I’ve found the answer, I simply removed a comma after the ‘M’ is mysql_query line.

I’ve written 2 php pages to practice trying to insert data into phpmyadmin.

This is the code for my connect page.

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8”>
<title>Untitled Document</title>
</head>

<?php

$connect = mysql_connect(“localhost”,“root”,“”)
or die (“Connection failed”);

mysql_select_db(“phppractice”) or die (“Nope didn’t connect”);
echo “Connected”;

?>
<body>
</body>
</html>


And this is the code for the other page

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8”>
<title>Untitled Document</title>
</head>

<?php

require (“connect.php”);

$date = date(“Y-m-d”);
$write = mysql_query(“INSERT INTO people VALUES (‘’,‘Mickey’, ‘Mouse’, ‘$date’,‘M’, )”);

?>
<body>
</body>
</html>

The only thing I can think Im doing wrong is not running it correctly. What I’m doing is just opening the code in a browser. I always get the connected verification I’ve written but nothing is ever added to my database… any ideas…?

Try adding a “or die(mysel_error())” statement to the insert, and see if an error occurs during insert.

$write = mysql_query("INSERT INTO people VALUES ('','Mickey', 'Mouse', '$date','M', )") or die(mysql_error());

Im guessing there are a komma (,) too many… after the ‘M’…

Remove comma after ‘M’