php

Fetch specific field from a MySQL result array

Hi! I’m trying to retrive the field *media_file* from the first line of the query. I don’t figure how to do that. I’ve tried several times to get it by calling the multidimensional array $pages[0]['media_file'] with no success. I’m trying to have the first image of a series bigger and then append the other thumbs. Here the page that we...

Crop image in PHP

Hello, The code below crops the image well, which is what i want, but for larger images, it wotn work as well. Is there any way of 'zooming out of the image' Idealy i would be able to have each image roughly the same size before cropping so that i would get good results each time Code is <?php $image = $_GET['src']; // the image to ...

Running a website from an encrypted partition

I am looking at the possibility of running a PHP-based website (built in symfony) from an encrypted partition on a LAMP server. The reason for this is because a client would have access to the server but I don't want them to see the source code behind the php website. I am open to other solutions if this is not possible. For example, p...

Twitter API: Get Followers +99

Hi, Using the twitter API (and OAuth) if i was to call for the user followers, (statuses/followers) i would be returned only 99 results. Is there a way i can return 99, then call again starting at follower 100 then looping through this style of calling until the total number of followers has been returned? Or just return ALL followers?...

Using URL contents to send data(post or get) to a PHP page.

OK, I am creating a questionnaire application that is managed by a single user on /manage. There, he can create multiple questionnaires, each with a different name and set of settings(registered users, questions, data, etc.). Currently, the different tests are accessed by non-administrative users(the takers of the test) by going to /inde...

Why can't I create a Doctrine model named 'Album'

I'm using Doctrine as ORM in my project but ran against a strange error: Using following YAML: Album: tableName: dpp_album actAs: [Timestampable] columns: name: string(255) description: string(255) online: boolean I then generate my models but upon refreshing my page and autoloading the models, PHP serves this error...

How do you use memcached with Prepared Statements?

Caching regular SQL queries is simple enough. public function query($sql) { if( $result = cache::get(sha1($sql)) ) { return $result; } $result = $this->connection->query($sql); cache::set(sha1($sql), $result); return $result; } But how do you cache queries with prepared statements since you don't know what t...

Why would curl ignore CURLOPT_TIMEOUT_MS (but honor CURLOPT_TIMEOUT)?

I am using curl to call a web service API. The service can unresponsive so I want to set a timeout. When I use CURLOPT_TIMEOUT things work as expected. But when I use CURLOPT_TIMEOUT_MS (note the 'MS' for milliseconds) the timeout doesn't appear to kick in at all. php.net tells me that the latter was available since PHP version 5.2.3, an...

PHP downloading question

On my site, users can input links to files and I can stream the download process to them through my server. I use a system like this: header('Cache-control: private'); header('Content-Type: application/octet-stream'); header('Content-Length: ' . $r[2]); header('Content-Disposition: filename=' . $theName); flush(); $file = fopen($file...

Cakephp comment form input keeps the same value after i press add

Hello, I've created a blog site from "Beginning CakePHP from novice to professiona"-David Golding. I have the comment view listed below: <div class="comments form"> <?php echo $form->create('Comment');?> <fieldset> <legend><?php __('Add Comment');?></legend> <?php echo $form->input('name'); echo $form->input('cont...

Kill Running PHP Script via Process ID?

Hello all, I make lots of GET requests to several PHP scripts via AJAX. I want to ask for implementation advice on how to kill a PHP script that is currently running (in the background). Is there some way to get the PHP scripts process ID when it runs and then I can probably kill that process via shell/cmd etc? Is there a better way? ...

Magento product images new option

Hey guys, how do i add one more option to product image list? like Exclude & Remove checkboxes ...

incompatibility issue: use which web browser for developement?

i have a mac. i wonder which browser (safari or firefox) i should use to develop my prototype, firefox or safari? because i have noticed they will give different effects. some things working in safari dont work in firefox and vice versa. could someone also give me some advices of how to deal with incompatibility problems. ...

Parse php array

Im using a class that returns a rather large (I guess) array. How do I get the value of the div's class attribute - in this array its 'display:none' - Its the output from a print_r. Here is the array: http://joe-riggs.com/large%5Farray.php Also the class I'm using that is returning this array is simplehtmldom_1_11 - so there may be a ...

Nice way to pass parameters to PDO

Positional parameters become a nightmare when dealing with more than 3 or 4 parameters. Named parameters are verbose. I'm thinking of doing this: query("SELECT * FROM users WHERE username = ", $username, " AND password = ", $password) With dynamic parameters (using func_get_args()), every second one being transformed into a positional...

send variables from php to jquery?

ive got a forum. when i click on a thread it passes GET variables through URL to another php page that displays that thread. url?threadid=10 and ive got a reply form in the bottom. when the user click submit reply it will execute jquery that call a php through ajax. i have to pass the threadid variable to the ajaxcalled php file but ...

Best way to organize applications?.... (MVC design pattern)

When building applications, whats the best way to decide what goes where. How do you know what functions to put in what controllers and models. For example, I'm building an application that is based highly on location. Users can post different things, that will in turn be shown to other users within a certain distance. Also, each user wi...

How to install Zend Framework on Windows

"installing Zend Framework is so easy!!!!" yeah right... Ok I'm working with a beginner's book and the ONE thing that is not excessively detailed is the most important part: Installing the darn thing. After browsing the quickstart guide for hours, all it said was: "download Zend [...] add the include directory (bla bla) and YOU'RE DONE...

jQuery AJAX Post not working

I cant not figure out why this script doesnt work. It has to do with something within the AJAX POST script/function. Right now, when I hit submit on my form it runs the php code on the same page. What it should do it is send the values of the form to project_ajax.php, then at page will return a var of success that will be true or false. ...

[jQuery] Why is $(document).ready not firing for me?

In a php file i have used include to include the following js.php file and prior to that i have included the jquery file. <script type="text/javascript"> $(document).ready(function(){ alert("hello"); }); </script> But it doesn't work. Why? when I skip the $(document).ready function it works. But i need jquery code inside. what ...