php

Is mysql_query under PHP a blocking function?

Suppose I am executing several queries on the server using mysql_query. The results of every query affect the subsequent query. Will every call of mysql_query be completely executed before control moves on to the next one? Edit: I forgot to mention, I am not using a transactional storage engine. ...

<div> of images, retrieved by getJSON, disappear after append()

Hi all I'm working on a GMaps application to retrieve images, via getJSON(), and to populate a popup marker. The following is the markup which I add to the marker dynamically: <div id="images"></div> <div id="CampWindow" style="display:none;width:550px;height:500px;"> <h4 id="camp-title"></h4> <p>View... (all links o...

PHP Library to test loading speeds

I was wondering whether there is a simple PHP library to test the loading speed of a web page or a single resource similar to Google Page Speed and Yahoo! YSlow. The reason is that I'd like to build a web based alternative. ...

Cookie is setting twice (duplicated)

I'm new to cookies, and im trying to set a cookie where to store the referrer (the org ref). But when i try this function: function do_it_cookie() { // Check if cookie exists if (isset($_COOKIE['ref'])) { // It dose exist, do nothing or anything... } else { setcookie ('ref', $_SERVER['HTTP_REFERER'], time() + 60, '/'...

php array_filter without key preservation

Hi, if i filter an array with array_filter to eliminate null values, keys are preserved and this generated "holes" in the array. Eg: The filtered version of [0] => 'foo' [1] => null [2] => 'bar' is [0] => 'foo' [2] => 'bar' How can i get, instead [0] => 'foo' [1] => 'bar' ? Thanks ...

Help Fix a bug - Unexpected T_STRING

So I have just rebuilt my server, just on local network. Stick my site back on it, try to run the code, and I get a anice T_STRING error. This is all very strange, as I have not changed the code :S <?php $window_ID = -1; if(isset($_POST["window_ID"]) AND $_POST["window_ID"] != null){ $window_ID = trim($_POST["window_ID"]); } ?> Thi...

problem on zipping big files

Using this code to zip a folder and it works perfect on small files like 18-20 mb but when it comes to files like 80-90 mb it just doesnt work, i though it is related to php memory settings but not sure, $zipfile = new zipfile(); $folder = "path/to/folder"; if (is_dir($folder)) { if($dir = opendir ($folder)) { while (false !==...

PHP Forms checkbox calculation

Hello, I am trying to perform some calculations with a form but every time i try to work with checkboxes it goes wrong. The checkboxes are beign set on value 1 in the form itselff and are being checked if there checked or not. $verdieping = isset($_POST["verdieping"]) ? $_POST["verdieping"] : 0; $telefoon = isset($_POST["telefoo...

Find the right value in recursive array

I have an array with multiple sub-arrays like this: Array ( [0] => Array ( [Page_ID] => 1 [Page_Parent_ID] => 0 [Page_Title] => Overview [Page_URL] => overview [Page_Type] => content [Page_Order] => 1 ) [...

Removing most inline styles and properties with PHP

This question is related to a similar case, namely http://stackoverflow.com/questions/2488950/removing-inline-styles-using-php The solution there does not remove i.e: <font face="Tahoma" size="4"> But let's say I have a mixed bag of inline styles and properties, like this: <ul style="padding: 5px; margin: 5px;"> <li style="padding...

Help with SOAP request using PHP

I'm having a SOAP related problem in PHP. I'm trying to create arbitrary SOAP request using Nusoap_client class. The complete request including headers should look like the example below. Ofcourse the placeholders (string) should be replaced with actual values. POST /services/RecipeCouponAPI11.asmx HTTP/1.1 Host: example.com Content-Typ...

How do I aggregate results from an Adjacency list using PHP's SPL

I've tried using nested sets, and they become very difficult to maintain when dealing with multiple trees and lots of other complications.. I'd like to give PHP's SPL library a stab at this (btw, we are PHP 5.3, MySQL 5.1). Given two datasets: The Groups: +-------+--------+---------------------+---------------+ | id | parent | Cate...

Writing you own media library: where to start?

Hi, i'd like to add a media library to a custom-made CMS that is build on Zend Framework and Doctrine. The goal is to build something like Worpress's media library: you can upload media and then attach it to for example an article. Do you have any suggestions how to start on this? How should the database be designed? Is there any code...

How do I echo out something different when reached last row?

I am wanting to not echo out the comma at the end of the echo after the last row. How can I do that? Here is my code: <?php header("Content-type: application/json"); echo '{"points":['; mysql_connect("localhost", "user", "password"); mysql_select_db("database"); $q = "SELECT venues.id, venues.lat, venues.lon, heat_...

rename folder into sub-folder with PHP

Hi. I'm trying to move a folder by renaming it. Both the test1 and test2 folders already exist. rename( "test1", "test2/xxx1/xxx2" ); The error I get is: rename(...): No such file or directory I assume this is because the directory "xxx1" does not exist. How can I move the test1 directory anyway? ...

How should i store availability calendar information in mysql? for [id] [date] [available/unavailable]

I'm building a simple calendar for holiday cottages to show when they are booked or available. What would be the fastest mysql table design for this, bearing in mind when users mark dates as available/booked they will do so via a start date and an end date. i can see 2 obvious options Store 'booked' data for every day [more rows] or,...

Credit card payment gateway with "Transparent Redirect" in Europe

I'm looking for credit card payment gateway similar to Braintree’s Transparent Redirect but working in Europe area. Does anyone know such a gateway? Edit: Sorry for tagging it with "php" but since I will implement it in php I think it makes sens. ...

How to parse results from google blog search?

Hello! I'm trying to parse the number of results from google seach blog. Could somebody please help me! http://blogsearch.google.com/blogsearch?hl=en&amp;ie=UTF-8&amp;q=a&amp;btnG=Search+Blogs returns a complete page. On the right side you can see (Results 1 - 10 of about 2,504,830,546 for a. (0.05 seconds) ). How could I get 2,50...

I need to find a file in directory and copy it to a different directory

I merely have the file name, without extension (.txt, .eps, etc.) The directory has several subfolders. So, the file could be anywhere. How can I seek the filename, without the extension, and copy it to different directory? ...

How to uncompress in QT/C++ the data compressed in PHP (gzcompres)

I have a compressed string written by PHP gzcompress($string) I need to read it with C++ on QT. Any help is very appreciated! ...