php

New to OOP PHP, need critique on first Geo RSS Class

I'm completely new to OOP PHP and currently reading "PHP Objects, Patterns and Practice". I needed to develop something that will generate a GeoRSS feed. This is what I have (it works perfectly, I would just like some critique as to what I could do different / more efficiently / safer): class RSS { public $channel_title; public $chann...

PDO error message?

Here is a snippet of my code: $qry = ' INSERT INTO non-existant-table (id, score) SELECT id, 40 FROM another-non-existant-table WHERE description LIKE "%:search_string%" AND available = "yes" ON DUPLICATE KEY UPDATE score = score + 40 '; $sth = $this->pdo->prepare($qry); $sth->execute($data); print_r($this->pd...

best way to populate an input field with data from an SQL query?

I have a form which populates 3 fields based on the selection from an autocomplete field. That is fine and working well, however I have a 4th field which needs to be populated automatically based upon one one of the fields that got populated automatically by the autocomplete. what's the best way to populate that 4th field? here is my c...

JQuery + Json - first steps with an example

Hi. I need (recently) to get an array from the server after an ajax call created by jquery. I know that i can do it using JSON. But i don't know how to implement it with JQuery (im new with JSON). I try to search in internet some example, but i didnt find it. This is the code : // js-jquery function function changeSponsor() { $.aja...

the page from which the user is visiting the current page

I have a web site with several pages. Page1, Page2, .. etc I don't want the user to visit Page2 posting its URL directly in the browser because Page2 should be visited only from Page1. In PHP, what should I code in Page2 to know that the user was before in Page1 and clicked a link or something that brough him or her to Page2? Thanks. ...

PHP $_SESSION Implementation

Does anyone know how PHP maps session IDs to $_SESSION arrays? In other words, given session ID x, where does PHP pull the values from to populate the $_SESSION array? And given a session ID and the url it came from, is there any possibility of someone being able to gain access to the values in the $_SESSION array? ...

Is it possible to concatenate heredoc string in PHP..?

With normal PHP string you can do this: $str = "Hello "; $str .= "world"; $str .= "bla bla bla"; $str .= "bla bla bla..."; But can you do the same with heredoc string..? $str = <<<EOD Hello world EOD; $str .= <<<EOD bla bla bla"; bla bla bla..."; EOD; ...

Using mysql_* functions with a mysqli connection

I was wondering if the older mysql_* functions provided with php will work with a mysqli connection. ...

Deter direct access to files (mp3) but yet allow flash player to play songs (htaccess/php)

I know it's practically impossible to not allow a user to download an mp3 file with all the various methods out there. But I'm stuck in a situation where i need to make things slightly more private/secure for my customers. Here's my problem, I'm currently using this flash mp3 player http://www.flabell.com/flash/Flash-Mp3-Player-29 to st...

How to do Eclipse + Zend (Magento) Debugging on Local Machine?

I'm trying to figure out how to do debugging on Zend (more specifically Magento) code using Eclipse. This is the workflow I'd like: Set breakpoints in Eclipse. Open up Firefox or Chrome, pull up the site in the browser When code hits the breakpoint, Eclipse halts execution, letting me look trace everything. Right now, I debug the ap...

php image manipulation help or class?

im really having a tough time trying to upload images using php and mysql, and i really need help! this is what i want to do in natural language: 1. upload an image 2. check if format is okay(png, jpeg, gif) 3. rename the image file, so theres no ambugity in this format(eg. pic-$userid.gif) 4. upload the pic to the images/folder 5. an...

What are the pros and cons of using Java for a web site?

I had never heard that you can use Java for a web site. I just learned it today when my future employer told me. The web site in question runs @ 15,000 daily visitors and it's only the beginning, so is it faster than PHP? Why did they pick Java over PHP? What are the pro/cons for a website using java compared to PHP? What website sho...

PHP Beginner: Is using the exec command standard practice?

I am just starting php. I am just curious if there is a better way to do this. This displays all of my scripts in the same folder as this script. I am not sure if it is standard to use the exec command. It does not seem very portable. <html> <head> <title>My PHP Practice Scripts</title> </head> <body> <center><h1>PHP Scrip...

[PHP] How download big file using PHP (low memory usage)

Welcome, I have to download big file (1xx MB) using PHP. How can i download this without wasting memory (RAM) for temporary file ? When i use $something=file_get_contents('http://somehost.example/file.zip'); file_put_contents($something,'myfile.zip'); I need to have so much memory that size of that file. Maybe it's possible to do...

parsing/searching a beastly array filled with simple xml objects in php

Hi, So Im working on a Excel xml parsing class, and Im trying to search through an array of the header values of the file, to return the key integer. If I can get the key int, then I can grab an entire column by the value of the header in the file. I have tried using in_array, search_array and a bunch of other functions, but nothing is ...

help with php AND condition

Need help reworking this php code/logic. Right now, if I have no value for either column 'Duration' or 'Size', my html table is blank and I put a default value of n/a. I want to change the logic to continue to handle that condition and give an n/a value, but also add the logic to read if BOTH are n/a, then set my column 'Status' value ...

Placing Form Result on confirmation page not working!

I can't figure out why the first name is not picking up on the confirmation page? <div class="tu">Thank you, <?php echo $_GET['sender_first_name']; ?>.</div> <?php $sender_first_name = $_REQUEST['sender_first_name'] ; $sender_last_name = $_REQUEST['sender_last_name'] ; $sender_email = $_REQUEST['sender_email'] ; $sender_message = ...

In wordpress how do you write code that says "if this is a subcategory page ... display the name of the subcategory"?

I'd imagen that it would look something like this: <?php if (is_subcategory()): ?> <h1><?php the_category(); ?></h1> <?php else: ?> <h1>something else</h1> <?php endif ?> Can someone tell me how this should actually be written? ...

PHP multi curl - find out what proxy was used for a particular curl handle

I'm using multi curl with anonymous proxies, and I want to flag the proxies based on performance and location etc after the curl handle is returned. I've tried curl_getinfo() but that does not return information about the proxy used for that curl handle. Any ideas? I've thought about maybe a way to identify a particular handle and stor...

Want checkbox values out of while() dynamic list results - Need php code logic

I have a working dynamic image and text list page that shows results in table form. I've added check boxes (name = "select") to each item in the list results with the (relevant) code below. I want to filter the corresponding art_id's from just the ones with select ="1" echo "<tr align=\"left\" padding=\"1\"> <td align=\...