View Single Post
Old 01-03-2010, 02:54 AM   #3 (permalink)
Killswitch
The Contributor
 
Join Date: Feb 2007
Posts: 64
Thanks: 9
Killswitch is on a distinguished road
Default

Alright, this is the portion that is Updating, with a little bit of cleaning ( its for an admin area that honestly I will be the only one messing with ). Also note the $form_data is an array of the form fields via Xajax... so $form_data['title'] really is input name=title etc...

PHP Code:
// Setup and preclean some vars
            
$title trim(htmlspecialchars($form_data['title']));
            
$url $this->string_to_url($form_data['url']);
            
$parent = (int)$form_data['parent'];
            
$access serialize($form_data['access']);
            
$post_access serialize($form_data['post_access']);
            
$desc trim(htmlspecialchars($form_data['desc'], ENT_QUOTES));
            
            
// Attempt to insert data
            
$q $this->db->prepare("UPDATE forums SET `title` = ?, `url` = ?, `parent` = ?, `access` = ?, `post_access` = ?, `desc` = ? WHERE id = ?");
            
                
$q->bindParam(1$title);
                
$q->bindParam(2$url);
                
$q->bindParam(3$parentPDO::PARAM_INT);
                
$q->bindParam(4$access);
                
$q->bindParam(5$post_access);
                
$q->bindParam(6$desc);
                
$q->bindParam(7$idPDO::PARAM_INT);
                
            
// Check results
            
if ( ! $q->execute() OR ! $q->rowCount() > 0)
            {
                
$message '<div class="error"><p>Sorry, but we could not update this forum</p></div>';
            } 
Essentially (since some code was left out), if it couldnt process or no effected results, then I return the Sorry message, otherwise it tells me everything went fine, let me send you to this location now.

I just can't pinpoint what would cause this, as it seems either the ! or . , ' is causing it (well ' is out now due to ENT_QUOTES).

UPDATE - Problem not solved, but it seems to be the word 'only' screwing everything up. I have tried removing this word and it works correctly, but when I use 'only' in it it wont work.

Last edited by codefreek : 01-03-2010 at 03:05 PM. Reason: PHP tags added, Please Use The Right tags. Thank you.
Killswitch is offline  
Reply With Quote