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

php - Magento - Deleted Base url key -

javascript - Tooltipster plugin not firing jquery function when button or any click even occur -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -