PDO Problems

Discussion in 'PHP' started by xxKillswitch, Jan 2, 2010.

  1. #1
    Hey all, having a really weird issue with PDO that it really confusing me. I am writing a custom forum and trying now to finish up updating the forums information.

    It works fine, I can update the forum information, but the description is what has a problem. I wanted to have it say "moderators and administrators ONLY!", which is stored in mysql as text.

    When I do this, it didn't quite work. It reads now "moderators and administrators >". Anything after ONLY! is cut off and is just one single > symbol. I have tried removing the word ONLY and it magically works properly again.

    Anyone experience anything liek this? Here's some 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, $parent, PDO::PARAM_INT);
    				$q->bindParam(4, $access);
    				$q->bindParam(5, $post_access);
    				$q->bindParam(6, $desc);
    				$q->bindParam(7, $id, PDO::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>';
    			}
    			else
    			{
    				$message = '<div class="success"><p>This forum was successfully updated.  You will be redirected to the <a href="'.$this->config->url.'/admin/forum/index">Forum Manager</a>.</p></div>';
    			}
    Code (markup):
     
    xxKillswitch, Jan 2, 2010 IP