php

In PHP with PDO, how to check the final SQL parametrized query?

Hello, In PHP, when accessing MySQL database with PDO with parametrized query, how can you check the final query (after having replaced all tokens)? Is there a way to check what gets really executed by the database? ...

PHP Regex negation

I have a web bot which extracts some data from a website. The problem is that the html content is sent without line brakes so it's a little bit harder to match certain things so I need to extract everything that is between td tags. Here's a string example: <a class="a" href="javascript:ow(19623507)">**-**-**-***.cstel.net</a>&nbsp; (<b>...

Multiple function calls, only the last succeeds. Why?

I store an array of values in my cookie as a string (with ',' as separator). I update them using explode(), implode() and setcookie() methods in a custom function set_Cookie() and it works great. function set_Cookie($name, $position, $value) { $cookie = ($_COOKIE[$name]); $cookie_exp = explode(",", $cookie); $cookie_exp[$pos...

PHP PDO prepared statement -- mysql LIKE query

Hello All, This is my first post to stack Overflow, but I find the existing body of knowledge very helpful. At any rate, here's my issue: I am trying to do a search through php's PDO class (mysql driver). I have the following query working with the mysql client (table names changed to protect the innocent): SELECT hs.hs_pk, ...

Closing ODBC connection doesn't write Excel file

LS, Basically my code opens a connection to the Excel file, performs an UPDATE query, and closes the connection again. When I execute a SELECT on the file, and output it, it does reflect the updated data, but when I close the connection and send the file to the user, it doesn't have the data in it. It seems that the data is written af...

CSS randomly breaking?

Breaking in two senses, 1) Functionally breaking and 2) <BR>eaking to a new line. I have no idea what's causing this problem.. but randomly as I load divs of data with php, I'll get maybe 1 out of 10 to bust: I can't for the life of me figure this out. Has anyone experienced this before? It's not any specific column or row that's ha...

MySQLi - Server returned unknown type 246

Hi there, I've been working on a content managed site that's been working fine on localhost. I've just uploaded the files to my mediatemple server.. and am seeing some pretty interesting results: Warning: mysqli_stmt::bind_result() [mysqli-stmt.bind-result]: Server returned unknown type 246. Probably your client library is incompatible...

php CMS system built with a framework - php framework AND php CMS

I have to develop a CMS for a friend of mine, nothing commercial... I'd like to take this opportunity to learn a php framework, to see if it would be suitable for future (and more complex) developments, or at least to steal some nice ideas... SO I'd like to easily implement a content management system and at the same time have a look a...

how to detect .flv movie file URL ?

when theres a flash video, how can i detect the current flv URL ? viewing the source doesn't reveal it. However, I wonder if theres any approach to figuring out the .flv URL (Where it's hosted at the moment it's being streamed). I see that there are firefox add on's that does this. I wonder how these work, and whether it can be implemen...

Including javascript in a drupal page or form

Is there a drupal function or convention for including JavaScript onto a page or form? My current solution is to hard code the script tag as part of the output of my form's theming function, but it seems like there should be a better way, since JavaScript should generally be the last thing loaded on the page. ...

Setting auto increment lower than the current highest value?

I have a MySQL table with an auto-increment ID field. I'm filling the table with data from one source, with its own unique ID (starting from around 4 million up). I also want to insert my own data but don't want it to conflict with the IDs already in the database. Ideally I'd just insert it all at a lower ID. However, I have to use a fu...

GD/PHP heatmaps on geographical background

I am trying to reproduce the heatmap effect Bungie uses to show kills/deaths on specific halo 3 maps using PHP and GD. (Example: http://www.bungie.net/stats/halo3/heatmapstats.aspx?player=gatts007 - pick a map like "Guardian" for a better example.) I have all the data and background map images from my game, but I am having trouble comi...

reading twitter's rss search feed with simple xml

Having some trouble selecting some nodes in the rss feed for twitter's search the rss url is here http://search.twitter.com/search.rss?q=twitfile each item looks like this <item> <title>RT @TwittBoy: TwitFile - Comparte tus archivos en Twitter (hasta 200Mb) http://bit.ly/xYNsM&lt;/title&gt; <link>http://twitter.com/MarielaCelita...

PHP sleep() inside loop not updating DB

Hello, I have a php file that is fired by a cronjob every minute. When the php file is fired it updates the database, sleeps, etc It is programmed like this: $start = microtime(true); set_time_limit(10); for($i=0;$i<5;$i++) { updateDB(); time_sleep_until($start + $i + 1); } If this piece of code is run i don't see any chan...

preg_match_all Problems

Hello, I'm trying to match a string that contains HTML code that contains parameters to a function in Javascript. There are several of these functions found in the the string containing the HTML code. changeImg('location','size'); Let's say that I want to grab the location within the single quotes, how would I go about doing this? T...

Why does browser sends HTTP GET requests that return empty responses?

I tried to post this question on serverfault but no luck so far. I have a local testing environment in a Fedora virtual machine. Strangely, resources (css and js files) don't seem to load. Looking at Firebug, I see that the browser sends the HTTP request with "Range bytes=0-". The server responds with either an empty 200 OK or an empty ...

how come in php superclasses can access protected methods of their subclasses?

I just noticed this behavior today - weird, I'm pretty sure in java a you can only access protected methods upstream on the inheritance chain since going the other way violates encapsulation. Was there a reason for this behavior in the language? ...

Why can't I access session variables from my AJAX-called PHP script?

I have one PHP script with a session variable, set like so: $_SESSION['VAR1'] = "test" Now, I am using AJAX via a jQuery-initiated POST request, and so I have a script named ajax.php which has all the required functions. And when I try access my session variable (echo $_SESSION['VAR1']) in ajax.php, it produces nothing. Does session...

[PHP] Whitespace in email issue

I'm experiencing a strange problem and difficult to diagnose because it's random. I have built an application that sends out an email with a nice amount of text (don't have exact char count, but could get it). On the html email, a random whitespace appears in the content. See below for examples of how the space wanders and is random: ...

Image rollover-zoom near mouse

I have an advent/christmas calendar. Everyday is another picture with one more door opened. To make these regions clickable I used CSS and IDs like this: CSS: ul#doorregions { list-style: none; background: url(<?php echo($pictureoftheday); ?>) no-repeat 0 0; position: relative; width: 950px; height: 575px; margin: 0; pa...