php

Ajax page does not update consistently

I've recently started exploring using AJAX for a small project, and I've had reasonable success though it's not as smooth as I would like. The Basic setup is that an applications named ProphetX which interfaces with Excel to show stock market prices. Prices are updated as they change in Excel. Using VBA I save the data from the spreadsh...

Auto incrementing unique url

I am looking to create an auto incrementing unique string using PHP, containing [a-Z 0-9] starting at 2 chars long and growing when needed. This is for a url shrinker so each string (or alias) will be saved in the database attached to a url. Any insight would be greatly appreciated! ...

Effectively using Google App Engine to send lots of emails using PHP?

I currently have a client website on the Grid server on MediaTemple that will be moved to a Virtual Private Server soon. Currently it's using some hacks to trickle his massive email sendouts using cron jobs and queuing with the database (to avoid going over the limit MediaTemple set). We can't use third party solutions (like MailChimp ...

check for MySQL connection (OOP PHP)

I have various parts of my code that require me to check if a mysql connection is already established. Below i'm using if(self::$connection), but self::connection seems to always return "Resource id #6" rather than boolean - what am i doing wrong? class mysql_lib{ static $connection; static function connect($user = FALSE){...

How to sort this array ??

Hello, For the last 3 days, I have been trying to sort an array, but without success. I tried in the php file first and in the tpl file, but it was impossible for me to sort my array. Can you help me please ?? This is the structure of my array (thanks to the smaty debug tool !) : Array (5) attributes => Array (4) 23 => "1L" 24 =...

PHP calling tree objects

$var is an array: Array ( [0] => stdClass Object ( [ID] => 113 [title] => text ) [1] => stdClass Object ( [ID] => 114 [title] => text text text ) [2] => stdClass Object ( [ID] => 115 [title] => text text ) [3] => stdClass Object ( [ID] => 116 [title] => text ) ) How can we call [title] from some [ID]? (without touching...

Zend_Gdata_Photos listing all albums and photos

I'm using the Zend_Gdata_Photos PHP client to access the Google Picasa API, trying to just do something very simple, list all the albums, and then list all the photos within each album. This is my code: $client = Zend_Gdata_ClientLogin::getHttpClient('*****', '*****', Zend_Gdata_Photos::AUTH_SERVICE_NAME); $gp = new Zend_Gdata_Photos($c...

How to use the -> in PHP

Possible Duplicate: What does this php construct mean: $html->redirect(URL)? Hi, I've been looking for what this operator "->" does, but I can't seem to find a reference to it, only people using it in come and I can't make out what its doing, an explanation would be appreciated. ...

PHP XPATH Mind Melt

Really simple xpath call but I am having a mindblock. My XML file looks like this <?xml version="1.0"?> <books> <book>bob</book> </books> I want do an XPATH call to find the node with the value of bob whcih seems to work but whenever I put a no exsistent book value in, it still returns the node of bob. My XPATH Query is /books/b...

List of useful Apache modules for PHP development

I'm rethinking which modules I need for local PHP development. Which of these modules have you found essential for you, or rarely used, or never used for PHP development. Please share your experience, or share any other that aren't on this list. a: actions_module, alias_module, asis_module, auth_basic_module, auth_digest_module, authn_...

Problem reading files greater than 1GB with XMLReader

Is there a maximum file size the XMLReader can handle? I'm trying to process an XML feed about 3GB large. There are certainly no PHP errors as the script runs fine and successfully loads to the database after it's been run. The script also runs fine with smaller test feeds - 1GB and below. However, when processing larger feeds the scr...

The route "foobar_by_name" does not exist. (using sfRouting in a task)

I have created a custom task in symfony (1.3.6), running on Ubuntu 10.0.4. I am generating urls in the task. This is a snippet of some of my code: // In the custom task (lib/task/mySomethingSomethingTask.php) protected function execute($arguments = array(), $options = array()) { //create a context $app = sfProjectConfigura...

PHP algorithm for CDN distribution

IGNORE THE QUESTION: The CSS File I was including pulled in the the other files hence the correlation *facepalm* We have the following code for picking a CNAME CDN reference per filename. It must return the same URL everytime based on a given filename. We thought this would be sufficiently random: <?php function cdn_prefix($fileN...

Accented characters in PHP mail

Hello, I need to send emails with accented characters from a webservice written in nuSoap using PHP mail: Code is the following: $from="[email protected]"; $to="[email protected]"; $subject="My strange email"; $body="Hello, i would like to see accented chars like thes: èèéé òòò ç"; $headers = 'MIME-Version: 1.0' . '\r\n'; $headers .= '...

PHP new array()

$var is an array: Array ( [0] => stdClass Object ( [ID] => 113 [title] => text ) [1] => stdClass Object ( [ID] => 114 [title] => text text text ) [2] => stdClass Object ( [ID] => 115 [title] => text text ) [3] => stdClass Object ( [ID] => 116 [title] => text ) ) Want to update it in two steps: Get [ID] of each object and throw i...

php: grabbing user info from database, is this code secure?

Hello. So i was wondering if i this is OK or if theres another better and secure solution to grab info from the database. if (isset($_SESSION['user_id'])) { $string = mysql_query("SELECT * FROM users WHERE id = '$_SESSION[user_id]'"); $v = mysql_fetch_array($string); } Because I was thinking maybe its possible to hack the "session" an...

Parse error: syntax error, unexpected T_SL on line 23

I am getting this error: Parse error: syntax error, unexpected T_SL on line 23 Here is line 23: $selectorder = <<<ORDER Here it is in context: $grid->setUrl('myfirstgrid.php'); $selectorder = <<<ORDER function(rowid, selected) { if(rowid != null) { alert("selected: "+rowid); } } ORDER; $grid->setGridE...

PHP include file in foreach Loop

Hey Guys Will I be ok doing this? foreach ($item as $val) { include('external_script.php'); } Where external script is about 800 lines of code I want to keep separate for organizational sakes. Gracious! ...

How to disable thread safety in PHP?

I am using some software that requires me to have thread safety disabled. I am working on a Windows server. From what I've read elsewhere, I can't just configure this in the .ini file. Is this true? If so, how would I compile it so that thread safety is turned off? Thanks! ...

Dynamic image gallery generation using PHP and jQuery

I've got an idea in my head, something I want to create, but am not sure about the best approach. I'd like to pitch the idea and get some opinions on a smart way to go about this before I dive headfirst in the wrong direction! I've got a photography website that displays multiple portfolios for a few different photographers. It's got th...