I have a question regarding bools in php. I have a stored mysql proc that is returning a boolean. When this value is grabbed on the php side it displays the value as being a 0 or 1. This all seems fine to me and I have read in the php manual that php will interpret a 0 or 1 as false or true at compile time but this does not seem to be th...
This is the script I have written for gzipping content on my site, which is located in 'gzip.php'. The way I use it is that on pages where I want to enable gzipping I include the file at the top and at the bottom I call the output function like this:
print_gzipped_page('javascript')
If the file is a css-file I use 'css' as the $type-a...
I am writing an app that will need to unzip user uploaded archives. PHP provides the ZipArchive class, but it should also be possible to unzip using unzip via exec(), my question is which is preferrable in terms of performance & scaling?
...
I am storing some text values in memcached. An example of such a string is:
El Salvador (República De El Salvador)
When I attempt to retrieve the string, I get an empty string. I suspect this is something to do with UTF-8 strings. How may I store foreign language text in memcached?
...
I am in the middle of developing a PHP social media web application which will be supported by various web services each operating a REST API. Web services will probably be implemented in Java with MySQL data layer but the whole point of what I am trying to do is make it really easy to implement modules in different languages/data stores...
So, $logarray[$row]["time"] is fetched from a MySQL table and placed into an array. The value is stored as a 10 digit int. When I try to pass it into the second parameter of date(), it tells me its expecting a long type, not a string type. So, I tried casting it into an int (couldn't find a long caster...). The error went away, but now i...
Hello,
How can I prevent adsense ads to show up on a certain page? You see, I would like to exclude adsense from displaying on the About Us page on this website, but I'm not sure how to go about doing it...
I just had a look at my index.php file and noticed that it contained the following line of code:
<div><?php echo show_ad_camp_1()...
I'm having a problem connecting 2 different processes that I have working. I've been tasked with pulling data out of a database, creating a file from the data, and then uploading it to an ftp server.
So far, I have the file being created and downloadable using this code, $out being a string that contains the complete text file:
if (...
Right now i'm on testing something in a database. It's a wordpress database. i have to write and delete and do other operation on it. As you know it, it has indexing mechanism that will always make every new post inherit the next highest possible ID.
Please consider that this database is a copying of used database. it has been written b...
I have this function:
function coin_matrix($test, $revs) {
$coin = array();
for ($i = 0; $i < count($test); $i++) {
foreach ($revs as $j => $rev) {
foreach ($revs as $k => $rev) {
if ($j != $k &&
$test[$i][$j] != null &&
$test[$i][$k] != null) {
...
Hi, I feel this is something to do with my httpd setup for apache. I'm using mod_rewrite if that helps but I think that only effects the url.
It seems when I output some data such as:
$sMessage = 'Error';
echo $sMessage;
It works fine but when I do this:
$sMessage = 'Error';
echo '<p>'+$sMessage+'</p>';
It returns 0. Very odd!
...
This may be a bit of a php n00b question but i've managed to get it working this far and I'm a little bit stuck. I'm pulling 12 images with descriptions out of a database. I want to insert them into a client rotator that has 3 sets of 4. They will be contained in divs called clientrotate1, clientrotate2, and clientrotate3 respective...
Now comes the hard part. How do you optimize this function:
function coin_matrix($test, $revs) {
$coin = array();
for ($i = 0; $i < count($test); $i++) {
foreach ($revs as $j => $rev) {
foreach ($revs as $k => $rev) {
if ($j != $k &&
$test[$i][$j] != null &&
$tes...
I ran tests on my website using Google's PageSpeed and it recommends that I "Leverage browser caching" and provided the following resource:
http://code.google.com/speed/page-speed/docs/caching.html#LeverageBrowserCaching
This resource never explains how to actually change the expiration date of my http headers. Do I do this through ....
currently i have a database of music that i have db'd in mysql, now i am writing a php frontend for it, and it will list out everything in a table, it works, but if i search "the beatles" it gives me 453 results(correct) however if i just search "beatles" it results in 0 rows, how would i go about making it able to search for something l...
Hi,
I am try to add id from one table to another table to give a relationship to the tables. I am doing this on a number of tables on insert of data from a form. Example: person owns and item so item has item and person ids to link the two, however in some cases I have optional tables so sometimes the ids of those tables will be added ...
I've been a keen fan and user of CakePHP for about 2.5 years now, but the main bugbear that most fellow developers level at the framework is that it's slow, and the dispatch cycle takes too long to make it a viable solution for production environments.
I'm hoping that this question will inspire people to share their tips, tricks and hac...
I have mysql database structure like below:
CREATE TABLE test (
id int(11) NOT NULL auto_increment,
title text NULL,
tags text NULL,
PRIMARY KEY (id)
);
data on field tags is stored as a comma separated text like html,php,mysql,website,html etc...
now I need create an array that contains around 50 randomly selected tags...
I'm experiencing a bizarre problem with sockets between a Java Knopflerfish client bundle and a PHP (CLI, not web) server.
The client/server pair work fine when both are located on the localhost, and all data is transmitted successfully. However, when the Java client exists on a different machine, connections to the server are successfu...
How do I serve a different page to iPad viewers?
...