php - Running queries in PDO without binding -
Can you run questions in PDO without preparing them? I am getting acquainted with SQL-injection which may be born with it, but I am in a testing environment.
I want to be able to write pure MySQL questions and just have to execute them, do not prepare queries, placeholders, etc. ...
I have the following Like would like to be able to execute a query. INSERT (table_id, car, bike, value (1, 'BMW', 'Suzuki', 2004)
In the table, I think that this Errors that are running directly on the query are running.
Thanksgiving statement is not the main idea that you can tie the parameters, but you can do it. Reuse the compiled statement several times , Thereby increasing efficiency.
Ready-to-execute workflow as well as for unused use cases The PDO also provides other methods:
- executes a statement and returns the number of affected rows, it is useful for initial stuff, but
SELECT < Not suitable for / code> s.
- Static query is useful, which does not include unreliable input. It is similar to ready-execution but does not allow parameters, and compiled query Reuse of Mati does not.
is not in combination with one of these limits, they are usually only static query (ie, query a plain string and variables).
You can safely avoid user input, so that you can
// untrusted data: $ car = 'bmw'; $ Bike = 'Suzuki'; $ Years = 2004; ... $ dbh- & gt; INSERT (Table_ID, car, bike, date) values (1, '. $ Dbh-> Bid ($ car).', '. $ Dbh- & gt; ($ Bike) inside the' exec 'table.' , '. $ Dbh- & gt; Bid ($ year).') ');
But it is so uncomfortable that you
$ dbh-> ('INSERT' (table_id, car, bike) in the table ('car' = & gt; $ car, ': bike' = & gt; $ bike, ': year' =) values (1, : Car, bike, year) ') - & gt; & Gt; $ Year)); Instead
.
- Static query is useful, which does not include unreliable input. It is similar to ready-execution but does not allow parameters, and compiled query Reuse of Mati does not.
Comments
Post a Comment