php

Does PHP proc_nice leave Apache threads at new priority setting?

When executing proc_nice(), is it actually nice'ing Apache's thread? If so, and if the current user (non-super user) can't renice to its original priority is killing the Apache thread appropriate (apache_child_terminate) on an Apache 2.0x server? The issue is that I am trying to limit the impact of an app that allows the user to run Ad...

Can mysql_pconnect be called multiple times in one php page?

I was just wondering if it is valid to call mysql_pconnect multiple times in one php page? Also, if it is possible do I have to somehow close my last mysql handle or something? Basically is the following code ok? Or lacking some other steps? mysql_pconnect("ip:3306", "user", "pass") or die(mysql_error()); mysql_select_db("Test") or die(...

PHP MySQL fails whenever WHERE statement is present

I am trying to make a simple query to a small MYSQL table, but when I insert the Where clause, I suddenly get an invalid query error (added a while(mysql_fetch_array ){} when working without the where). The MYSQL console gives a 1064 (syntax) error, however, I checked the MYSQL documentation and I am using the proper syntax as far as I c...

Handle CURL headers before downloading body

Using PHP and CURL (unless there is a better alternative then CURL in this case), is it possible to have a php function handle the header response before downloading the file? For example: I have a script that downloads and processes urls supplied by the user. I would like to add a check so that if the file is not valid for my process...

How can i write a Nusoap client script for asmx web service?

I need a php client base on nusoap lib. to get a asmx service response with haeder auth enabled: This is the Request (using soapUI): <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:res="namespaceurl"> <soap:Header> <res:AuthHeader> <!--Optional:--> <res:UserName>myuser</res:UserName>...

Are Prepared Statements a waste for normal queries? (PHP)

Nowadays, "Prepared statements" seem to be the only way anyone recommends sending queries to a database. I even see recommendations to use prepared statements for stored procs. However, do to the extra query prepared statements require - and the short time they last - I'm persuaded that they are only useful for a line of INSERT/UPDATE qu...

php in javascript?

i need to have some php code inside javascript <script ...> <?php echo " ... "; ?> </script> but this doesnt work. how can u implement php inside javascript that is in a own file javascript.php? ...

Best way to return search info from a database in php

So I have a form for people to fill out, which is below... Once they fill that form out, how can I query it and return the information from my database? <form name="form" method="get" action="agents.php"> <table> <tr> <td width = "20%">Last Name: </td> <td><input type="text" name="LASTNAME" size="20"/> ...

what is the simplest way to recover profile information from orkut for a user (ideally oauth-like login)?

There is a facebook api to recover information about the user, and maybe his friends list as well. Just like that is there something like that for orkut? Hopefully, there will be a class or library written in php. Does something like this exist? ...

Best Practices: How to check for a constant in an array using PHP?

I'm not really sure how to do this. I have an object and I want to set a 'type' property on it, but before doing that I want to check to make sure it's a valid type. I was thinking this is a good time to use constants since the type names won't change (nor do I want them to be). // this is just a sample of what I was thinking: class Fo...

Emailing in PHP

Hi, I've found several tutorials on how to do this, but it doesn't work. Here's my simple emailing code: <?php $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $zone = $_POST['zone']; $call_time = $_POST['call_time']; $comment = $_POST['comment']; $to = 'MY EMAIL'; $subject = '$name is interested in you...

Getting Doctrine to use MySQL "FORCE INDEX"

I have a query in Doctrine's DQL that needs to be able to use MySQL's "FORCE INDEX" functionality in order to massively reduce the query time. Below is what the query basically looks like in plain SQL: SELECT id FROM items FORCE INDEX (best_selling_idx) WHERE price = ... (etc) LIMIT 200; I assume I have to extend some Doctrine compon...

Cross language development problem

I'm working on a project that involves a database (My SQL), website (PHP) and a custom high performance server application (C++). The C++ application (and its accompanying client application) make up the main bulk of the project, with the database storing long term data for it. The website is primarily for displaying various statistics, ...

extreme ajax implementation in web service?

if one wants to make a website that acts like a desktop software, isnt it better to just use one page and use ajax to retrieve all other php-files and update the content of current page with eg. jquery? i mean, just ONE page, you get the idea of my question i think... is this to recommend? what is the pros and cons? i mean, its really...

Is it possible to override the Subversion HTML pages?

I have a subversion server, providing subversion access via Apache2 and mod_dav_svn The system works fine and clients can access the repositories with SVN client such as TortoiseSVN etc. Users can also access HTML renderings of the same URLs. Can these renderings be over-ridden, or replaced? If so, how would i go about it? ...

PHP Zend Route Config.ini - similar patterns

Hi, I'm using a configuration file to route my requests in my application. I have the following entries: routes.deal.route = "deal/:id/*" routes.deal.defaults.controller = "deal" routes.deal.defaults.action = "index" routes.deal.reqs.id = "\d+" routes.deal.route = "deal/buy/:id/*" routes.deal.defaults.controller = "deal" routes.d...

Split string between two characters?

Ok this one should be incredibly easy, but I don't know what I'm looking for... I want to split a string up between two characters $string = "blah blah blah (blorp) blah blah (bloop) blah blah (bam)"; retruns : array 1 -> blorp 2 -> bloop 3 -> bam I dont need any of the blah blahs just everything within parenthesis. Thanks! Arthu...

using .htaccess to modify asset paths base on domain (multiple sites on one symfony app).

I'm building a symfony application thats made to run many sites. Similar to this article. So far so good except he uses some .htaccess "voodoo". To make it so image and css file links get rewriten so to point to a assets directory named after the current domain. Again read the article above if that doesn't make sense. Here is the line ...

Detecting if integer can be written as sum of given integers

Hi Supposing I'm having the constants 3,5,6,9,10. How can I detect how to write $n, which is the input, as a sum of these constants with the least number of terms? Examples $n=10, S=10 $n=18, S=9+9 $n=24, S=9+9+6 $n=27, S=9+9+9 $n=28, S=10+9+9 Thanks ...

Problems sending html email in php

I'm trying to send an email to myself that has a layout and images. What I'm I doing wrong? <?php $message = $_POST['message']; $emailsubject = 'site.com'; $webMaster = '[email protected]'; $body = " <html> <body bgcolor=\"e7e7e7\"> <style type=\"text/css\"> #body {margin: auto;border: 0;padding: 0;font-family: Georgia, 'Times New ...