I’m using a query in Codeigniter to return the ids of all the rows that belong to a user. This returns Is it possible to return a flat array like ? Answer The CodeIgniter documentation (most particularly, query results) doesn’t list anything that will produce a flat array result (like the PDO::FET…
PHP multiline string with PHP
I need to echo a lot of PHP and HTML. I already tried the obvious, but it’s not working: How can I do it? Answer You don’t need to output php tags:
Best way to write arrays to a file? [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year. Improve this question I want to avoid writing to DB and use constants/array for lang files et…
Insert elements from one array (one-at-a-time) after every second element of another array (un-even zippering)
What would be an elegant way to merge two arrays, such that the resulting array has two items from the first array followed by a single item from the second array, repeating in this fashion? Desired result: I’m trying to do it using a for loop with multiple counters, but I don’t know that the arra…
PDO and MySQL ‘between’
I’m trying to get PDO to work with a MySQL ‘between’. Below is my code: What gets returned is an array with ‘0’ or ‘NULL’ for values. When I hard code the end date, it acts as if start_date is set to -1, retuning me all rows before the end_date. So, what am I doing wr…
How can I get the total number of items in a DynamoDB table?
I want to know how many items are in my dynamodb table. From the API guide, one way to do it is using a scan as follows: However, this has to fetch all items and store them in an array in memory which isn’t feasible in most cases I would presume. Is there a way to get the total item
php – finding keys in an array that match a pattern
I have an array that looks like: Array ( [2.5] => ABDE [4.8] => Some other value ) How would I find any key/value pair where the key matches a pattern? I will know the value of the first …
imagesx() expects parameter 1 to be resource, boolean given
I am using a image thumbnailing library (Laravel’s resizer bundle) which takes a jpg from a directory and uses imagesx() to save that image in a different size. This works without error most of the …
PHP PDO access to MySQL
I went through the process of converting mysql_* code into PDO code. I’ve run it and checked that it works and everything. I just want Stack Overflow’s review of it, to make sure that I’m killing …
PHP Script to Traceroute?
I have a website running PHP on a GoDaddy shared linux server. I need to determine if users are connected to the companies VPN. If I simply do $_SERVER[‘REMOTE_ADDR’] it gives me the clients IP address. However if I can dig deeper with a tracert, the 2nd hop would show up as the companies IP addre…