Skip to content

PDO get the last ID inserted

I have a query, and I want to get the last ID inserted. The field ID is the primary key and auto incrementing. I know that I have to use this statement: That statement works with a query like this: But if I want to get the ID using this statement: I get this error: What am I doing wrong?

Query with a PHP foreach using OR and LIKE %?

I have sort of a tricky problem, and I want to see if there is an easier way about solving it. I have let’s say $numbers= $_GET[‘numbers’]; //resulting in $numbers=array(1,2,3) The count in the …

Regexp ignore certain parts in string

I need to use regex for a string to find matching results. I need to find the (.+?) but would like to ignore everything where it says (*) right now: $regex=’#<a …

Why are my Amazon S3 images loading slow?

It seems like the images read from amazon s3 load really slow. I had the images on the same server as the website and it loaded super fast. Is it loading slow cause it has to access it from s3 now? …

SQL get results 21-30?

This seems like a really simple question but I can’t seem to find information on it. If I have 100 results, and I only want to get the results results between 21 and 30 (from the order my SQL query is grabbing them), how would I accomplish this? Answer You can use this: E.g.,

How to attach PDF to email using PHP mail function

I am sending an email using PHP mail function, but I would like to add a specified PDF file as a file attachment to the email. How would I do that? Here is my current code: Answer You should consider using a PHP mail library such as PHPMailer which would make the procedure to send mail much simpler and better…