decimal - What could ever be wrong with the following mySql code? -


the following basic , simplest code ever wrote, wrong code?

<?php     $con=mysqli_connect("localhost","root","myroot","mydb");     // check connection     if (mysqli_connect_errno())       {        echo "failed connect mysql: " . mysqli_connect_error();       }     else       {        echo "connecting server localhost succeeded ! ";       }     // add column      $sql="alter table june2013 add time_interval (decimal(5,2))";     if (mysqli_query($con,$sql))        {         echo "column added successfully";        }     else        {         echo "error creating database: " . mysqli_error($con);        }     mysqli_close($con); ?> 

i error message says:

connecting server localhost succeeded !!! error creating database: have error in sql syntax; check manual corresponds mysql server version right syntax use near '(decimal(5,2))' @ line 1

any idea why i'm getting this?

could missing "column" statement?

$sql="alter table june2013 add time_interval (decimal(5,2))";

should be

$sql="alter table june2013 add column time_interval decimal(5,2)";


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -