I am writing a very simple upgrade script that adds a field in the sales table of my programs database. The code runs fine without error, but does not add the field in the sales table. I have echoed the query and then copied that text and pasted it into phpmyadmin, and it worked fine, I just don’t know why it won’t work in the code.
[php]
<?php include ("../../settings.php"); if(isset($_GET['process'])) { $conn = mysql_connect("$server", "$username", "$password") or die("Could not connect : " . mysql_error()); mysql_select_db($cfg_database,$conn); $upgradetable=$cfg_tableprefix.'sales'; $query="ALTER TABLE $upgradetable ADD comment VARCHAR(100) NOT NULL AFTER sold_by"; mysql_query($query,$conn); echo 'PHP Point Of Sale's database has been successfully upgraded to version 7.2, please delete the upgrade and install folders for security purposes.'; } else { ?>Clicking submit will upgrade the database to version 7.2, no data will be lost from the database.
[/php]