I would like to ask for help with converting my mysql_* query to prepared statement using PDO technology. There are many of them which I cannot find on the internet how to solve them properly – mostly advanced ones like this one for example:
mysql_query("SELECT * FROM pet_auction JOIN people ON (pet_auction.pet=people.guid)
LEFT OUTER JOIN login.account ON (pet_auction.winner=login.account.id)
WHERE active=1 AND seller=$userid ORDER BY id DESC");
How to succesfully convert it to PDO STMT using these?:
$people = new PDO("mysql:host=localhost;dbname=people", "myuser", "mypass");
$login = new PDO("mysql:host=localhost;dbname=login", "myuser", "mypass");
Thank you all I rather will not try else it would be false because i tested already … I have no idea how to convert LEFT OUTER JOIN and multiple databases together.
You do not need to open a pdo object for each database. Just give myuser grant access to both login and people databases. Then query like so: