I wonder if any PHP/MySQL experts out there can help me. I have written a PHP code which I am hoping will add new columns to my table in a database. Here is the following code:
<?php
// All the database connection codes here
$retro = mysqli_real_escape_string($con, $_POST['retro']);
$moon = mysqli_real_escape_string($con, $_POST['moon']);
$astronomicalunit = mysqli_real_escape_string($con, $_POST['astronomicalunit']);
$sql = "ALTER TABLE Planets
ADD (COLUMN 'RetrogradePrograde' VARCHAR(45),
COLUMN 'NumberOfMoons' VARCHAR(45),
COLUMN 'DistanceFromSun' SMALLINT(5));";
$sql = "UPDATE Planets
SET RetrogradePrograde = '$retro',
NumberOfMoons = '$moon',
DistanceFromSun = '$astronomicalunit';";
// all the mysqli connection failure notification here
// close mysqli connection
?>
But when I try to run this program on my browser, I get the message "Error: Unknown column 'RetrogradePrograde' in 'field list'" How can there be an UNKNOWN column when I have just created it? Please help.