I am designing a script for customer notes.
When a customer note is first opened and then saved, an array consisting of the Unixtimestamp, techid and the note is saved in MySQL.
When I go to open up the existing customer notes, I have a form where new information goes in, and then in the space below shows the previous note in the array already in the database.
When the new note is saved, what I want is for the new information to be spun into an array of the Timestamp, TechID and the Note, and then to be added to the end of the array saved on the database already. So basically one MySQL field with an array holding a series of arrays.
What I have done is setup on the open page, the values are written to MySQL, and that works. However when I go in to look at the notes and then add to them, I tried using an a "array_push() " to add the information to the existing array... I get an error on the page saying the first argument to arraypush needs to be an array.
Below is the source, can anyone help.
Thanks in advance...
Phil
$closed='0';
$time=strtotime("now");
$currentnote=array(array($currenttime,$note,$employee_no));
$dbaddticket = "insert into troubletickets values ( NULL , ";
$dbaddticket = $dbaddticket." '".addslashes(stripslashes($reg_no))."' , ";
$dbaddticket = $dbaddticket." '".addslashes(stripslashes($time))."' , ";
$dbaddticket = $dbaddticket." '".addslashes(stripslashes($time))."' , ";
$dbaddticket = $dbaddticket." NULL , ";
$dbaddticket = $dbaddticket." NULL , ";
$dbaddticket = $dbaddticket." '".addslashes(stripslashes($employee_no))."' , ";
$dbaddticket = $dbaddticket." '".addslashes(stripslashes($currentnote))."' , ";
$dbaddticket = $dbaddticket." NULL , ";
$dbaddticket = $dbaddticket." '".addslashes(stripslashes($closed))."' ) ";
$result = mysql_db_query($dbname,$dbaddticket); if(mysql_error()!=""){echo mysql_error();}
<!-- add to the existing notes-->
$existing_notes=$rowdisplay[note];
$currentnote=array($currenttime,$note,$employee_no);
$writenotes=array_push($existing_notes,$currentnote);
$dbquery = "Update troubletickets set ";
$dbquery = $dbquery." note='".addslashes(stripslashes($account_notes))."' ";
$dbquery = $dbquery." where (ticket_no='$ticket_no')";
$result = mysql_db_query($dbname,$dbquery);