I'm developing a system to manage in a very simple way some tables in the database.
The system first loads with Ajax the databases the user can see and manage. Then load the tables in that database and then load the data for that table.
I have something like this:
$.ajax({
url : "myUrl.php",
data : {
db : $dbSelector.val(),
table : tableToLoad
},
success : function (json) { /* Some cool stuff here */ }
});
And I've found you cannot use parameterized queries when the parameters are the db name, tables or columns, so I cannot do:
<?php
$query = "SELECT * FROM :db.:table";
$st = $pdo->prepare($query);
$st->execute(
array(
"db"=>$db,
"table" => $table
)
);
$rows = $st->fetchAll(PDO::FETCH_OBJ);
I cannot use mysql_ or mysqli_ filtering cause we don't have it installed.