Disclaimer
Please excuse my ignorance, I've written C# for more than 12 years now and I'm quite comfortable with the .NET framework and OO programming, and I've got a good background in enterprise applications, but this is my first bout with PHP.
Question
Alright, so I'm trying to figure out how to issue a prepare
using the mysql_query
function and I'm not able to put two and two together. Right now I connect like this:
mysql_connect('xxx.x.x.x:xxxx', 'x', 'x');
mysql_select_db('x');
And that is succeeding.
Now, I want to insert some data and so I'm looking at the mysql_query
function and just can't figure out how to send a parameterized query to prevent SQL Injection. My code currently looks like this:
mysql_query("INSERT INTO users (email, password, ...)
VALUES (:email, :password, :...)
But how do I pass the array of values to it?
Additional Question
If I'm using mysql_real_escape_string
on every value that I receive via user input, do I need to worry about issuing parameterized queries?