In this chapter you will find examples for the various PDO use cases.
I am the only person to hold a gold badge in
on Stack Overflow and I am eager to show the right way for PHP developers.
Besides, your questions let me make my articles even better, so you are more than welcome to ask any question you have.
Click here to ask!
Please refrain from sending spam or advertising of any sort.
Messages with hyperlinks will be pending for moderator's review.
Markdown is now supported:
If you want to get a reply from admin, you may enter your Eómail address above
Please feel free to delete this comment, but I cant seem to see any of the examples on the page /pdo_examples (this page) and also the /articles page. I can only see the heading <h1 followed by the link to the comments section of the page. This happened a couple of weeks ago. Luckily I have bookmarked all of the pages with the individual examples on (select, insert, update etc) as I use this site as reference quite often. I have checked this in several browsers on several machines in different localities, so I'm pretty sure it's not me. Thanks for the help you provide to me and the community in general. You have completely changed the way I code PHP and MySQL. Cheers.
Could you perhaps give an example of a PDO DELETE other than the single example in the main tutorial article? I've been finding a lot of SQL-injectable examples, and I think it might be best if you simply make a short article covering this just for completeness... and because I just had to chide my best friend for a DELETE that used the $needle directly instead of protecting it with PDO ... which is insanely injectable, and repeated many places around the web.
Thanks in advance if you choose to do this!
You are absolutely right. I've no idea what I was thinking about when didn't include a page for DELETE. Now I added one, thanks to your suggestion!
Hi Are we able to call procedures or routines with PDO?
Hello, yes, it is covered in the main article, https://phpdelusions.net/pdo#call
Can you explain how to use NOT IN query and UNION query in PDO please? I need help.
Hi. How can we count the number of columns of a table with sql pdo?
my php programs which worked fine on my local server are now no longer passing through "Post" data from forms on the production server. Do i need to alter the PHP config file, any help would be most appreciated.
is there safe way to use FILTER_VALIDATE_URL to validate URLs in PHP?
thanks again for your help
It depends on what do you call "safe". Generally, I would consider FILTER_VALIDATE_URL safe enough.
Hi ther im unable to find any good tutorial on php PDO. Im heaving trouble with inserting into database. I tryd namespaces and other method and always error : "no parameters were bound". If you have time to check my code, or give me a link of good course. im trying to create register and login.
thanks in advance!
Excellent tutorial, thanks. Could you recommend a book covering PDO and web programming in more detail?