sql - MySQL String, check is column exists -


i creating column created current date if not exist. current query check column name , create 1 if not exist. variable $date , not work, please can suggest wrong it.

$result = mysqli_query($con,"     if not exists (       select *        information_schema.columns       table_name = 'scouts' , column_name = '$date'     )     begin       alter table scouts add '$date' varchar( 255 )     end "); 

sql injection not problem being hosted on local machine. sorry if wasn't clear @ first.


Comments

Popular posts from this blog

rest - Spring boot: Request method 'PUT' not supported -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

symfony - imagine_filter() not generating the correct url in LiipImagineBundle -