MySQL_Narb Posted June 30, 2012 Share Posted June 30, 2012 Will this code (not including XSS) prevent all malicious changes/deleting in a database, such as SQL Injection? I just want to be sure this code is the best I can make it. /* * @METHOD processInsertQuery * @DESC prepares a query for use, then runs it */ public function processQuery($query, array $binds, $fetch) { $query_handle = $this->dbc->prepare($query); if(!$query_handle->execute($binds)) { $error = $query_handle->errorInfo(); echo $error[2]; } //update insertId var $this->insertId = $this->dbc->lastInsertId(); //incase we ever want to get the number of rows affected //we set our row_count variable to the number of rows //affected $this->row_count = $query_handle->rowCount(); if($fetch == true) { return $query_handle->fetchAll(); } } Quote Link to comment https://forums.phpfreaks.com/topic/265030-is-this-good-enough-for-database-connection/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.