Skip to content

Tag: php

preg_match bbcode

I currently have bbcode like this I’d like to use php’s preg_match so I can get the value of the image.jpg, regardless of what’s next to ‘caption=’. …

php adodb MSSQL connection

I have a linux server that I’m trying to use php adodb to connect to a MSSQL server. I’ve install mssql through yum etc and I know the server can connect to it as I’ve tried the following: Any ideas why my adodb wont connect, or any examples on how I can connect would be much appreciated. An…

change the PHP path to MAMPs PHP

I’m running PHP with MAMP on OSX 10.5.8 So if I want to run a script from console I always need to write which is annoying. Is there a way to change the default path to php so that I can write and still uses MAMPs PHP version? Answer Create a file called .bash_profile on your home directory (if you

Select on empty table but still get column names

I want to do a SELECT on an empty table, but i still want to get a single record back with all the column names. I know there are other ways to get the column names from a table, but i want to know if it’s possible with some sort of SELECT query. I know this one works when i

How to change the path to php.ini in PHP CLI version

The php that run on the webserver and the CLI version is not using the same php.ini file. If I do a command php –ini, it show this while my web version uses the php.ini in C:wampbinapacheApache2.2.21binphp.ini. This is probably very common for people using wamp. How do I change the Loaded Configuration …

Generate array of random unique numbers in PHP

I’m trying to generate an array of random numbers from 0-n then shuffle (but ensure that the keys and values DO NOT match). For example: Note that both keys and values are from 0-4 but none of the keys and values are the same. Any thoughts? Answer