I am using php against SQL Server 2008 using the mssql driver. Anyone know of a way to pass a table value parameter into stored procedure? Answer Table-valued parameters are not yet supported by the PHP MSSQL Driver. You’ll have to try something else, like converting your TVP into XML and passing it as …
Output text file with line breaks in PHP
I’m trying to open a text file and output its contents with the code below. The text file includes line breaks but when I echo the file its unformatted. How do I fix this? Thanks. <…
Executing PHP script based on Outlook rule
I am getting daily data dump via e-mail, which is being processed by Access (based on the Outlook rule, VBA is extracting the attachment and running Access procedures, so I get a report). As data …
PHP Session Id changes between pages
I have a problem where i am losing the PHP session between 2 pages. The session_start() is included in a file called session-inc.php into every page requiring a session to be set. This works for all pages on the site except one particular page, member-profile.php. When this page is visited a new session with …
Finding the number of days between two dates
How to find number of days between two dates using PHP? Answer
PHP: filter_var sanitization secure enough?
I have a PHP script with the following line: Is this safe enough? How would you improve this code? Answer It is safe for that case, but for a more general approach, I’d rather use mysql_real_escape_string in conjunction with type casting: In the worst case, that will result in a 0 and will escape all ma…
Remove newline character from a string using PHP regex
How can I remove a new line character from a string using PHP?
Remove warning messages in PHP
I have some PHP code. When I run it, a warning message appears. How can I remove/suppress/ignore these warning messages?
regular expressions – same for all languages?
is the regexp the same between languages? for example. if i want to use it in javascript, would i have to search for regexp for javascript specifically. cause i got some cheat sheets. it just says regular expression. i wonder if i could use this on all languages, php, javascript and so on. Answer The basics a…
How to generate random date between two dates using php?
I am coding an application where i need to assign random date between two fixed timestamps how i can achieve this using php i’ve searched first but only found the answer for Java not php for example : Answer PHP has the rand() function: It also has mt_rand(), which is generally purported to have better …