I just got this quite large CakePHP app (about 20k lines of code), which isn't very clean and there is no documentation at all. The app is running in production, but it has really major problems with performance.
Server is Quad core with 8GB RAM, but the app can serve only about 3-4 requests/s, which is very very bad. Each request take...
Hello,
This question is similar to http://stackoverflow.com/questions/944158/php-multiple-dropdown-box-form-submit-to-mysql, but with a twist.
Let's assume we have an HTML multi-select, which gets submitted to a PHP backend.
How do you elegantly create a mysql request with an OR condition on the values of a multi-select?
For instance...
PHP Explorer is the eclipse PDT tab (the leftmost in standard configuration) where you can browse the folders of your project. I believe the same tab in standard eclipse is called "Project Explorer" but I am not sure.
What happens to me is that when I close and reopen eclipse, although the files that were open at close time are still op...
Hi!
I need to use preg_reg on some string with content from a html file.
$file = file_get_contents($path);
$html_array = explode(' ', $file);
The problem is that the array looks sometimes like this:
[77]=>
string(35) "<div>
</div>
<br>
{{testto}}
<br>"
I have tried to put in some whitespaces there.. :P Won't work.. :/ L...
I've got a site with tags like robotics, programming, simulation, quizzes etc. and I want to limit the number of links being displayed for a certain tag to a number. For example if there are 20 nodes that actually have quizzes as a tag then only 10 nodes should b displayed that have quizzes as a tag and the rest of the nodes can be displ...
The only tools/plugins I've seen online that allow for multiple files to be selected for upload through one single dialog box using a SHIFT or CTRL click action (as opposed to clicking on a single file per for file uploads) exist for controls made in Flash/.NET/Java, not just straight Javascript/HTML/PHP.
Why is that the case? I'd ima...
I have a table called cms_page in which each page has an ID. I want to pull all the information from this table and all the information from cms_page_part table where page_id is equal to the ID i send to the page...confusing i know but here is my attempt:
require '../../config.php';
$conn = new PDO(DB_DSN, DB_USER, DB_PASS);
$id = (in...
I have a WordPress template that contains the following element:
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes('xhtml'); ?>>
This returns:
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en-US">
Unfortunately the "lang" attribute is invalid XHTML 1.1 - and the client would like thi...
I have my data in this format: U+597D or like this U+6211. I want to convert them to UTF-8 (original characters are 好 and 我). How can I do it?
...
I have a php file with a variable $total as one of its variable.
AS part of my project I have to print a table of results.
I call an external javascript whenever i display the table, something like this
echo "<script src='course.js' language='JavaScript'></script>";
echo "<table border='1'>";
echo "<tr>";
echo "<td><td>";
Each row o...
I'm in the process of evaluating the benefits of Zend_Config_Ini versus using a simple constant file.
e.g. -
define('DB_HOST',localhost);
//versus
$config = new Zend_Config_Ini('/path/to/config.ini', 'staging');
echo $config->database->params->host; // prints "dev.example.com"
The only thing is that the $config is not globally ac...
actually i am looking for jquery and php script for checking domain name availability and whois.
like this example
http://davidwalsh.name/?s=WHOIS%20Domain%20Availability%20Checker
Thanks
...
I am creating a virtual soda vending machine, and I am having issues with the
html part of the virtual soda vending machine.
I want the user to be able to select money via a drop down list
so that when the value of money is selected we sent that value
to a php script that will only do stuff if selection == cost, and
if selection != c...
Could anyone help with this please?
I am pulling the results in below from the cms_page_part table. I know for a fact there should be two rows. One where "name" is equal to "body" and the other that exists is "testionial" however my query below only prints the first one. Is it because im fetching the results incorrectly?
<div class=...
I find myself frequently outputting PHP Array data into AS3 applications and I'm always having to do it the hard way - comma delimated, base-64 converted data with custom packers/unpackers on either end.
I'd really like an AS3 function that takes the default output of PHP's print_r and converts it to a (potentially nested) AS3 array. Is...
I'm implementing a memcache to cache mysql query results.
It loops thru the mysql results using
while($rowP3= mysql_fetch_array($result3)) {
or it loops thru the memcached results (if they are saved in memcache, and not expired) via
foreach($cch_active_users_final as $rowP3) {
This is probably something thats really obvious... b...
Is it possible to use "or" or "and" in a switch case? Here's what I'm after:
case 4 || 5:
echo "Hilo";
break;
...
How can I optimize this code?
$items[0] = "Item-0";
$items[1] = "Item-1";
$items[2] = "Item-2";
$items[3] = "Item-3";
...
$items[n] = "Item-n";
foreach($items as $item) {
mysql_query("INSERT INTO mytable (item) VALUES ('$item')");
}
The array is just sample and the key point I like to know is how can I insert n items without quer...
Hello,
I wanted to simulate a railway network where there would be stations, trains and routes connecting each station. So how do you think I should attempt to model this?? I thought of using graphs taking station as vertex and edges as routes. Also since there will be tens of trains and stations and hence hundreds of routes so should I...
Hi!
I'm working on multi-tenant application in Zend Framework which gets it's tenantID from the subdomain name (mod_rewrite -> index.php -> matches it against the database).
My question is - how do I set this variable (tenant id) to be available for every Controller?
Leonti
...