[eluser]USCTrojans[/eluser]
Hello, I'm trying to create a numerical system of storing fields in documents on couchdb. I am numbering each field as an integer, when I add to it I am using some php to get the next consecutive number for the field to be ordered. Everything is working fine but for some reason each post is inserted twice and I can't figure it out.
Here's my model. Any help would be greatly appreciated
Code:
function message_submission()
{
$cloudroom_document = strtolower($this->input->post('cloudroom'));
try {
$info = $this->couchdb->getDoc($cloudroom_document);
$array = (array) $info;
$number = count(array_keys($array)) - 1;
//$number_string = $number;
$number_string = (string) $number;
$message = array('username' => $this->input->post('username'), 'message' => $this->input->post('message'));
$doc->_id = $info->_id;
$doc->_rev = $info->_rev;
$doc = $info;
$doc->$number_string = $message;
try {
$update = $this->couchdb->storeDoc($doc);
$response = "the document was found and successfully updated";
}