Hi all. I am not sure if this should be in PHP or MySql, but it is more relevant to MySl. I am designing a helpdesk for my department. Currently I am entering data into a form, which submits that data to a MySql table. That table is then displayed on a seperate page with checkboxes so I can "complete" a ticket, which should move it from the current table to a seperate table and then delete the original record. Currently the Complete button for this is successful in deleting the record, but it does not suceed in inserting the record into the second table. I am pretty sure my syntax is messed up, but I am not sure how to fix it.
Here is the code:
` if($_POST['complete']){
for($i=0;$i<$count;$i++){
$del_id = $checkbox[$i];
$sql = "INSERT INTO $tbl_name2 SELECT * FROM $tbl_name WHERE tixnum='$del_id'";
$sql = "DELETE FROM $tbl_name WHERE tixnum='$del_id'";
$sql=sprintf($sql,(int)$del_id);
$result = mysql_query($sql);
}
if($result){
echo"<meta http-equiv=\"refresh\"content=\"0;URL=completeopen.php\">";
}`
The Database and Tables are defined as such
<?php
$host="localhost";
$username="root";
$password="";
$db_name="opentix";
$tbl_name="opentix";
$tbl_name2="closedtix";
//Connect and Select
mysql_connect("$host","$username","$password") or die("Cannot Connect");
mysql_select_db("$db_name")or die("Cannot Select Database");
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
?>