title: Check if a MySQL statement is reading or writing
body: <p>I'm currently working on a PHP extension where I'll be giving users the authority to write an SQL (in a <code>textarea</code>), and I'll be executing it.</p>
  
  <p>But for obvious security issues, I'd like to "validate" the SQL before actually executing it. One thing I know for sure is that the SQL my users are supposed to write is only to read/fetch data. So what I want to do is check if the SQL is reading (SELECT, SHOW) or writing (UPDATE, DELETE, DROP, CREATE, INSERT, etc.), without actually executing it (for obvious reasons).</p>
  
  <p>So is there any way of acheiving this in PHP/MySQL?</p>
  
  <p><strong>NOTE</strong> I can't restrict the MySQL user's access, since the same user is being used in other extensions, and needs write access. I can't create a new user just for this either.</p>