I'm trying to set the Auto Increment of my tables st_id to = 201406001
ALTER TABLE support_ticket AUTO_INCREMENT=201406001
When doing this it worked and now my "st_id" (AI, Primary key) is set to 201406001 just as I wanted.
When I ran that query it said it affected 4 rows which is right, because there were 4 rows in the table when I ran that query.
But now when I try and update the status of a specific column in one of those 4 rows, it will not update.
Is my ALTER TABLE query wrong?
I tried running the following query to only target the st_id like this, but gave me an error.
ALTER TABLE support_ticket.st_id AUTO_INCREMENT=201406001 FROM support_ticket
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM support_ticket' at line 3
So my question is, should I stick with my original query, as it did work, or should I try to get the 2nd query working?
Also, could running that 1st query be that be the reason I cannot update my column now?
This is my first time using ALTER TABLE so any help would be of use.
Here is my update code: Form
<form method="POST" action="close.php" enctype="multipart/form-data"> <input type="hidden" name="st_id" value="<?php echo escape ($t->st_id); ?>"> <h3>Close this ticket...</h3> <select name="status"> <option value="<?php echo escape($t->status); ?>">Current Status: OPEN</option> <option value="0">CLOSE</option> </select> <input type="submit" value="CLOSE"><input type="button" value="Cancel" onclick="window.location = '/admin/maintenance/'"> </form>
include($_SERVER['DOCUMENT_ROOT'] . "/core/init.php"); $st_id = $_POST['st_id']; $status = $_POST['status']; $updatestatus = DB::getInstance()->UPDATE('support_ticket', $st_id, array( 'status' => $status, )); echo "The ticket was successfully closed.<br />
Solution to my UPDATE problem: Finally got it to update by this:
$st_id = $_POST['st_id']; $status = $_POST['status']; $updatestatus = DB::getInstance()->query("UPDATE `support_ticket` SET `status` = $status WHERE `st_id` = $st_id");