This question is actually inspired from another one here on SO and I wanted to expand it a bit. Having an associative array in PHP is it possible to sort its values, but where the values are equal to …
Email PDF Attachment with PHP Using FPDF
I want to email a PDF as an attachment that was created using FPDF. My code looks like this, but the attachment never comes through. Anyone familiar with doing this? I’m hoping to use the PHP mail() function. Answer This ended up working for me:
Setting up scripting and mysql database on separate servers
I have a unique setup for a web application that I need to get my head around. I have two servers that will need to talk to each other. Server A will host the actual PHP-based application; Server B will host the MySQL database and the server connection details. Server B will also be within a closed network, s…
PHP input sanitizer function?
What’s a method to sanitize PHP POST data for passing to a mail function? (I prefer a method that’s not part of the mysql_function() family of functions.) I take the data, sanitize it, print it back to the user and send it in an email to a preset address. EDIT: I’m just sending the email to …
how to do this.. backwards?
I currently have: $i = 1; while { echo $i; $i++; } And it shows: 1 2 3 4 etc.. How would I make it display backwards? For example 4 3 2 1 etc.. I basically want to do the exact same thing …
Doctrine 2: Update query with query builder
Hi I’ve got the following query but it doesn’t seem to work. This returns the following error message: Fatal error: Uncaught exception ‘DoctrineORMQueryQueryException’ with message ‘[Semantical Error] line 0, col 38 near ‘testusername WHERE’: Error: ‘testusernam…
facebook username validation regex pattern
i need a regex pattern to validate if a string is a valid facebook username? Answer According to this site…
dompdf and img tag, image wont show
Here is the HTML just before $dompdf->render() and $dompdf->output() are called: All other invoices display the image fine when viewing in the browser, or printing it, or emailing it as HTML. When I click ‘Generate PDF’ inside of our application, it renders the invoice in PDF, except the log…
Converting a number with comma as decimal point to float
I have a list of prices with a comma for a decimal point and a dot as the thousand separator. Some examples: 12,30 116,10 1.563,14 These come in this format from a third party. I want to convert …
How do I get next month date from today’s date and insert it in my database?
I have two columns in my db: start_date and end_date, which are both DATE types. My code is updating the dates as follows: What is the best way to make $end_date equal to $start_date + one month? For example, 2000-10-01 would become 2000-11-01. Answer You can use PHP’s strtotime() function: Just note th…