php

Creating JSON in php

It seems like I would be jumping through hoops to move data from MySQL into json via PHP json_encode - the encoding is taken care of, it's the pulling of the related data from the database and ensuring that you have array within array within array setup correctly (code snip below)...is there a json framework or something where you feed i...

How do I stop MSSQL truncating text when accessed from php?

When I try to retrieve the contents of a Text field from mssql in php I only get back part of the contents. I think its about the first 4000 characters. How do I stop this. ...

PHP Detect how many URLS in the string

I'm implementing a contact form for a website, and I'd like to avoid using a captcha because I believe it has a negative effect on user experience. Instead, I've decided to trial detecting the number of URLs that have been submitted with the message. I am retrieving the message as a string from the $_POST submission. I know inbuilt PH...

Make a PHP site send SNMP information to a network management app

Hi, I'm trying to make a PHP website send information through SNMP. I've been reading allot about SNMP, but I'm still a bit clueless about where to start. I believe I need to create an MIB with all the OIDs my website will use to send the info. Is this correct? How and where can I define those variables (OIDs)? Can someone point me in ...

adding one day to a date

My code to add one day to a date returns: date before day adding: 2009-09-30 20:24:00 date after adding one day. SHOULD be rolled over to the next month: 1970-01-01 17:33:29 <?php //add day to date test for month roll over $stop_date = date('Y-m-d H:i:s', strtotime("2009-09-30 20:24:00")); echo 'date before day adding: '...

How to extract value from hidden field on form

I have form (on my own blog/cms install which i want to play with a bit) with hidden value which i want to extract. Problem is that there are 2 forms on that page, each with that hidden field with value. On each form field name is the same, only hidden value differs. Something like this: <input type="hidden" id="_hiddenname" name="_hidd...

Parameters on php files run via cron

I have a php file that needs to be run on a cronjob and the top of it has the following #!/usr/bin/php -q i know the first part tells the server to interpret the file with php cause its not being run through the webserver, but what is the -q for? Also, are there other parameters? If so, where can i read more about them. Thanks ...

Errors inside of output buffer.

I'm having some problems with the output buffer. I am buffering my script and printing the result using a callback. The problem is that if a error is thrown at any point, nothing is being shown and I am getting a blank screen. I have tried setting my own custom error handlers but nothing seems to work. I have a feeling this is because th...

Using Node Data after Node is Created

I'm creating a custom PayPal "Pay Now" button based on the results of the creation of a CCK node. Basically, someone is creating their own "registration" for an event and then are redirected to a "pay now" page which is of the "PHP" input type. When I do a "print_r($_POST)", the variable is empty. How can I use the data just stored in t...

Practical experience deploying PHP applications compiled using the RoadSend compiler?

Does anyone have any practical experience with deployed PHP applications (using FastCGI), compiled using the RoadSend compiler? What have you noticed with respect to: memory consumption cpu utilization response time of the compiled application relative to the same application using the PHP interpreter? ...

Same elements from multiple files DomDocument loadHTMLFile PHP

It seems that when I have multiple files within the '/var/www/cal/attach/' directory, it only extracts the elements from the first file over and over again. Do I need to clear out the elements somehow to get this to work properly? What I'm trying to do is have the script go through multiple *.htm files, and parse data from the files int...

query to find a partial match

I want to write a query to find all the items in my 'schedule_items' table that match a YYYY-MM-DD value of a DATETIME field. something like: SELECT * FROM schedule_items WHERE start ?matches? '$date' Where start would be a DATETIME field with data like 2009-09-23 11:34:00 and $date would be something like 2009-09-23 Can I do this or...

Is there a good implementation of partial file downloading in PHP?

I'm writing a PHP script that allows the user to download a file. Basically the idea is to prevent the file being downloaded more than X times, since it is paid content, and the link should not be spread around. Since the files will be pretty large, it should be good to implement resuming. I've read the standard, but it's pretty long an...

Looping out mysql data

I have a mysql database of entries with dates. So what I want is to show all the dates in my database and then under each date, I want to show all the entries in the database entered on the specefic date. I am thinking of two loops but I don't know how to write the condition to display all the dates in my database before I loop out the e...

php pear net_dns

HI Does anyone know where I can find good documentation on the Pear module Net_DNS? ...

Php Syntax help for a noobie

Im working on a noobie app to pull some dates from the database and then a year later send me an alert (with cron). So far im struggling a bit and am trying to make a page which does my maths which I can work on building up. So far ive been debugging all day and reading tutorial after tutorial but am still getting errors. Very frustrati...

php include, all paths get messed up.

Hello. When i use php include to include a page in my website all the paths in the file i include get messed up. The included page acts like it is in the same folder as the page im including from. Is there way to avoid/fix this problem? ...

Zend_Validate: Db_NoRecordExists with Doctrine

Hey there, I'm trying to validate a form with Zend_Validate and Zend_Form. My element: $this->addElement('text', 'username', array( 'validators' => array( array( 'validator' => 'Db_NoRecordExists', 'options' => array('user','username') ) ) )); For I use Doctrine to handle my databas...

Updating a web app without any downtime

It's a PHP app. How can I minimize the downtime while updating the entire codebase? ...

PHP - How to compare arrays and extract the difference?

I have two arrays that I would like to compare and ultimately wind up with a single array with everything combined, having no duplicates. Can someone please tell me which function I should use? There are so many that it's a bit confusing. $array1[]['name'] = 'Kim, Jones'; $array1[]['name'] = 'Jim, Miller'; array1 is an array I built t...