Basically I can create a record using this, but it won't automatically update my ID column to allow for new records. Would i need to add in a expression to update the counter? Or is there a button or switch to make using phpmyadmin to automatically create the new id on submit?
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "message";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "INSERT INTO adminmessages (UserName, Message, Score)
VALUES ('SammyWest', 'Test1', '100')";
// use exec() because no results are returned
$conn->exec($sql);
echo "New record created successfully";
}
catch(PDOException $e)
{
echo $sql . "<br>" . $e->getMessage();
}
$conn = null;
?>
Table Schema
1 IDPrimaryIndex int(255) No None Change Change Drop Drop
Primary Primary
Unique Unique
Index Index
Spatial Spatial
Fulltext Fulltext
More
2 UserName varchar(255) No None Change Change Drop Drop
Primary Primary
Unique Unique
Index Index
Spatial Spatial
Fulltext Fulltext
More
3 Message varchar(255) No None Change Change Drop Drop
Primary Primary
Unique Unique
Index Index
Spatial Spatial
Fulltext Fulltext
More
4 Score int(255) No None Change Change Drop Drop
Primary Primary
Unique Unique
Index Index
Spatial Spatial
Fulltext Fulltext
More