php

Matching parts of URIs with Regular Expressions

I want to match this url /Real_estate_Listing_Detail.asp?PropID=245 with the ability to EXCEPT PropID numbers... In other words, Match /Real_estate_Listing_Detail.asp?PropID=ANY NUMBER HERE, except, 286,289,290,180 Thanks in advance... this shouldnt be as hard as I make it... This is for a wordpress plugin, so a single line experss...

can't connect to mysql with php

I can't seem to connect to mysql with a php script, even though I can connect fine with phpmyadmin. I created a user with a password, and gave it the proper priveleges for the db, but everytime it connects it dies saying access denied. I am using xampp on a windows xp box. Firewalls are all disabled, and I've checked the username nad ...

php mod rewrite

...

How do I print a single comment in drupal?

I want to print a individual comment in drupal based on it's comment ID. How can I do this? Google and other sources have yielded me nothing. Thank you. ...

Rss Function

I have a function to build a rss feed with PHP: function createRSS() { $currentDate = time(); $sql = "SELECT * FROM ". ADS_TABLE ." WHERE expires > $currentDate ORDER BY enterd DESC LIMIT 0,400"; $results = myExec($sql); // open a file pointer to an RSS file $fp = fopen ("mexautosrss.xml", "w"); if (!$fp) { ...

Format DATETIME column using PHP after printing

Hey, I am using DATETIME for my column for my database. I am trying to find the best way to format this date held in the row using PHP. I tried using date() but that would just print the current date. My row looks something like: $row['date_added'] Any ideas? ...

imagecreatefromjpeg is silently terminating scripts

Hello there, Like so many before me, I'm writing a PHP script to do some image thumbnailing. The script has earned WOMM (works on my machine) certification, but when I move it to my host (1&1 Basic), there's an issue: images above a certain filesize cannot be processed. I've moved all operations to the filesystem, to be certain it's not...

Error Showing Up in Server Logs...How Do I Stop It?

I'm getting an error and I've googled everything I can think of with barely any insights. Maybe you can help with a fresh set of eyes. I have a function that returns an array of objects. The code that calls this function then loops through this array and does what it needs to do with each object. It seems to work visually when it spits ...

how to add login/logout function and register without sql

I'm learning PHP and main my concern is adding activity to my website, but I don't know SQL. Is there a way to do this without SQL? ...

Passing variables and data through a regular web page link?

I'm working with a page where I'm trying to submit data when a link is clicked. I already know how to do this with POST and GET using javascript buttons, but how do I get the same effect when I'm working with HTML links? ...

Can IDE code templates boost my productivity?

Hello I have recently tried code templates after reading http://www.symfony-framework.com/2008/06/03/speed-symfony-developing-with-eclipse-snippets-templates/ in my Eclipse IDE for PHP development. I have an idea, when such tools can benefit for developer. Developers are constantly learning new tools, programming languages, frameworks ...

Too big data objects

Hello. Recently, I have identified very strong code smell in one of the project, I'm working for. Especially, in its cost counting feature. To count the total cost for some operation, we have to pass many kind of information to the "parser class". For example: phone numbers selected campaigns selected templates selected contac...

Does this regex in PHP actually work?

Hello all, I am hoping the regular expression experts can tell me why this is going wrong: This regex: $pattern = '/(?<percent>[0-9]{1,3}\.[0-9]{1,2})% of (?<filesize>.+) at/'; Should match this sort of string: [download] 87.1% of 4.40M at 107.90k/s ETA 00:05 [download] 89.0% of 4.40M at 107.88k/s ETA 00:04 [download] 91.4% of 4....

Keeping top 5 values in PHP efficently

I'm writing a small algorithm in PHP that goes through n number of movies with ratings, and will store the top 5. I'm not reading from a datafile, but from a stream so I cannot simply order the movies by rating. My question is what is the most efficent way to keep track of the top 5 rated movies as I read the stream? Currently I do the ...

DATETIME - three hours behind timezone

Hey, I am using DATETIME as a column type and using NOW() to insert. When it prints out, it is three hours behind. What can I do so it works three hours ahead to EST time? I am using php date to format the DATETIME on my page. Thanks, Ryan ...

The PHP function array_unique doesn't work

I have an array in PHP and I want to remove duplicates. I simply turned to the function array_unique() to create a new array and remove the duplicates. Here's the code: $unlink = array(); $unlink = array_unique($linkphoto); foreach ($unlink as $link) { echo $link, "<br />"; } Still it shows duplicates! Any suggestions about wha...

Detecting insufficient PHP variables: FALSE vs NULL vs unset() vs empty()?

What is the best way to define that a value does not exist in PHP, or is not sufficent for the applications needs. $var = NULL, $var = array(), $var = FALSE? And what is the best way to test? isset($var), empty($var), if($var != NULL), if($var)? Initializing variables as what they will be, e.g. NULL if a string, array() if they will...

Transfer images to server using PHP

I have some pictures that are online, the images are simple http://domain.com/pic.jpg for example; there's an upload feature but that's for user upload the user won't upload, it's an auto upload. This mean I have the Urls on an array and I want that php auto upload those Urls photo into the server Any help!! Thanks ...

Several Zend framework projects in the same root folder

Zend Framework project structure presumes you run only one application per server, like localhost/guessbook, where controllers and stuff are located one folder above that level. How can I have a few different ZF-based projects in my localhost so that to address them like I do with regular php script apps - with localhost/app1, localhost...

How do I get this PHP code to output HTML?

How do I get this PHP code to output HTML in order to enter the player's number and generate the tournament? <?php class RoundRobin { var $MaxTeams; var $MaxCombinations; var $tourn; var $mList; var $cList; var $cUsed; function RoundRobin($max) { $this->MaxTeams=$max; $this->MaxCombinations=($this->MaxTeams/2)*($this->MaxTea...