php

How to find all records which are NOT in this array? (MySql)

I have an array which contains a bunch of ID:s... I can't figure out how to write a query for finding all records which are NOT inside this array, in mysql. SELECT * FROM main_table WHERE .......... Any ideas? Thanks ...

PHP ini file_get_contents external url

I use following PHP function: file_get_contents('http://example.com'); Whenever I do this on a certain server, the result is empty. When I do it anywhere else, the result is whatever the page's content may be. When I however, on the server where the result is empty, use the function locally - without accessing an external URL (file_get...

Do Views Attachments require changing the Drupal templates

I've created a drupal views Attachment display that lists a bunch of nodes. How would I add this to a content type? I've seen examples that require changing the template files, but can views Attachments be used without making changes to the theming layer? ...

CakePHP - Fatal error: Call to undefined function

I get the Error Fatal error: Call to undefined function getAvnet() in C:\xampp\htdocs\ems\app\controllers\queries_controller.php on line 23 when accessing the source file attached. The line is: $ret = getAvnet('de', $searchstring); supposably calling function getAvnet($country, $query) The Source File ...

Perl to Php Translation

may you convert this Perl code to PHP code ? use HTTP::Request::Common qw(POST); use LWP::UserAgent; $ua = new LWP::UserAgent(agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5'); $ua -> timeout(0.5); my $req = POST 'http://forums.shooshtime.com/', [ vb_login_username => 'mehdi' , vb_lo...

How to convert the & character to and using PHP.

I was wondering how can I convert user submitted data that contains an & to and using PHP before its stored in the database. ...

validate time field entry

hi, is there any easy to validate a time field entry against the current date and time?i get date and time entry from an user in two separate fields. I used jquery date picker and time picker for both. with the date I had the option to show current date and future dates and not the past dates so it's good. with the time field i have to s...

Zend: best way to implement custom form validation?

I have a few custom form validation rules I wish to apply. Things like ensuring the password has one capital letter, at least one number, and a symbol. Where would be best to implement these custom validation rules? I am currently validating them in a controller, but obviously that won't scale very well when I expand. So I was going to...

PHP Function Organization

I am writing a pretty basic php app and have created a pretty big mess of functions to do various things, e.g. display_user_nav(), display_user_list() etc. I want a way to organize these in a logical way. What I really need is something like a ruby module, but I haven't been able to find a php equivalent. I also feel that from a programm...

Please Optimize My Pearson Code

Hello there...I was wondering if you can make the opization of my code. Because, when I aplied in localhost the running is about "17 MINUTES" ( calculation with 100000 query) For data is like this : $data[UserID][ItemID] = Rating ==> $data[1][1] = 5; This is my code : <?php include "......."; set_time_limit(0); ...

Combine 3 or more arrays (php)

Quick example: array_1 = 1, 2, 3; array_2 = a, b, c and array_3 = white, red, blue. I need an array like array_4 = ((1,a,white), (2,b,red), (3,c,blue)). I hope I'm not being to confusing. Thanks in advance. ...

Solr How to delete all records EXCEPT ones in an array?

I have a SolrPhpClient which I use to communicate with Solr. I can make queries very easy, like: $solr->deleteByQuery("id: 12345") Anyways, I wonder if anybody out there know of a way to delete all records in a Solr index EXCEPT ones I have inside an array... Is this even possible... Thanks ...

How to send email after 1 month with php

Hello. In my web-application, i want to create a some-type of calendar plus reminder. For example, i need to create task and i want to receive a e-mail notification after 1 month. How to implement it? Thanks in advance. ...

Reduce number of included files

Hello, My application based on Zend Framework and Doctrine includes > 300 files on each request. They are mostly the same files. This is a quite huge overhead. Partially solved by Zend_Cache (and Memcache), but not all the pages may be cached. How to reduce this number? How to speed up? Doctrine has an option to compile the needed ...

Wordpress: custom the_content filter is removing other filters, ie: wpautop

This is my first time playing with filters, so forgive me if this seems basic. I have done quiet a bit of googling and can't find anything related to my problem, from everything I have been able to find this should be working without an issue. It's my understanding that filters added manually run concurrent with any other filters wordp...

PHP replacing entire string if it contains integer.

My script lists out files in the directory. I am able to use preg_match and regex to find files whose filenames contain integers. However, this is what I am unable to do: I want an entire string to be omitted if it contains an integer. Despite trying several methods, I am only able to replace the integer itself and not the entire line....

php make unique hash of rss description

Hi all, im using php to create a sorta rss aggregator that stores data from multiple site rss feeds into a mysql database. since articles could be duplicated on many websites, i want to avoid this. ive been told you could use hashing to make unique hashes based on content of rss[description + title]. Now which hashing algorithm is fas...

HTML5 Websocket only works on localhost

I followed the HTML5 Websocket tutorial of the website below: http://net.tutsplus.com/tutorials/javascript-ajax/start-using-html5-websockets-today/ It worked well, then I changed the host value from "localhost:8080" to "218.175.192.160:8080" (my ip) in client-side page, the server side still kept "localhost:8080". It turns out that I ...

How do I evaluate PHP string as a variable?

I have a variable named $data["main_deal"] that has the value $xml->deals->deal[0] (as a string). $xml is a simpleXML object, and the value of main_deal is the selector needed to access the data I want. When I tried echo "<p><b>Main Deal:</b> ".$data["main_deal"]; it output: Main Deal: $xml->deals->deal[0] So I went back to where I gav...

MySQL + PHP: fetching data using foreign keys

I have 2 tables (Users, Wall). The UserID in the Wall table is a foreign key. How would I go about fetching the users details using this? (I want to fetch the users Forename and Surname who posted the message.) Users Table: Wall Table: EDIT: I cannot figure out how to show the data. <?php include('config.php'); ?> <!DOCTYPE html PU...