Skip to content

Tag: php

PHP Remove parameters from image extension

I am getting the image url from one function. I need to find the extension for the image. Sometimes the image url comes with parameters like http://slimages.macys.com/is/image/MCY/products/4/optimized/1776484_fpx.tif?$filterlrg$&wid=370. So, the file extension comes like tif?$filterlrg$&wid=370. How c…

Should I be unit testing every piece of code

I have been starting unit testing recently and am wondering, should I be writing unit tests for 100% code coverage? This seems futile when I end up writing more unit testing code than production code. I am writing a PHP Codeigniter project and sometimes it seems I write so much code just to test one small fun…

connecting to mysql via ipaddress with MySQL and mysqli

I have weird problem. I don’t have a domain name for my remote mysql database, so on my development machine I usually just connect to a remote mysql using the ip address. On my development machine the ip address connection works for both mysql and mysqli connections. However, when I upload to my live se…

Codeigniter or_where_in

I am trying to combine these two queries in Codeigniter. So the row either has to have the user_id of $user eg 3 OR have an id matching the array $repost. I know how to do or_where but how do you do or_where_in? Thanks Answer Syntax: Parameters: Returns: Return type: Generates a WHERE field IN(‘item’, ‘item’)…