I'm maintaining an inherited site built on Drupal. We are currently experiencing "too many connections" to the database.
In the /includes/database.mysql.inc file, @mysql_connect($url['host'], $url['user'], $url['pass'], TRUE, 2) (mysql_connect() documentation) is used to connect to the database.
Should $new_link = TRUE be used? My unde...
I have a PHP file that I need it to detect it's directory it's in. In my case I want it to return C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\
I think that this is pretty straightforward but if there is something you don't understand just comment
...
I am currently designing a forum as a personal project. One of the recurring issues I've come across is database queries in loops. I've managed to avoid doing that so far by using table joins or caching of data in arrays for later use.
Right now though I've come across a situation where I'm not sure how I can write the code in such a w...
I am developing under wamp.
echo realpath(APPPATH);
C:\wamp\www\salsaritmo\system\application
echo realpath(APPPATH . '..');
C:\wamp\www\salsaritmo\system
echo realpath(APPPATH . '../files'); //(which is the one i want)
returns nothing
...
When using Eclipse PDT with XDebug to debug a PHP web application, is there any way to open up a console window that will allow me to type in and see the value of arbitrary expressions in the current scope?
This would seem like an obvious element of the debugging environment, and I may be missing something, but the only thing resembling...
By default when system() and exec() functions are used in PHP the default user is SYSTEM so I can never see the result. Is there a way to change the user it runs on?
...
Basically I want the books to be text book based, ie, author discusses the background,philosophy,syntax,semtantix for every language AND after every section there are questions what you learned so far and mini projects. Is there any books like this, I'm absolutely new to php/mysql/javascript and web development in general. Thanks in ad...
I have a WordPress installation on my site, and I want to display WP posts on other parts of my site (that is outside the WP installation). How do I do that with PHP?
I tried to search this type of question on Stack Overflow, Google and WP official site but I didn't find anything.
...
Hey Guys,
This one might be a little confusing. I'm using AMCharts with rails. Amcharts comes with a PHP script to export images called "export.php"
I'm trying to figure out how to take the code in export.php and put it into a controller.
Here is the code:
<?php
// amcharts.com export to image utility
// set image type (gif/png/...
Is there an easy way (without downloading any plugins) to connect to a MySQL database in Python?
Also, what would be the difference from calling a PHP script to retrieve the data from the database and hand it over to Python and importing one of these third-parties plugins that requires some additional software in the server.
EDIT: the ...
Hi
I have a table with two columns:
column A column B
1 2
1 2
2 1
I want to return total of ones = 3 total of twos = 3
The best I can come up with is two queries like so:
SELECT sum(CASE WHEN columnA =1 THEN 1 ELSE 0 END )
+ sum(CASE WHEN columnB =1 THEN 1 ELSE 0 END )
SELECT su...
How can create simple PHP Search Engine Submission tool, which allows that to submit the site URL to multiple search engines such as "http://www.google.com/addurl?q=www.yoursite.com&hl=&dqq=" and also "http://www.bing.com/webmaster/SubmitSitePage.aspx" or any other other search engines?
...
What way it is to be to get two GET methods in the URL by htaccess?
RewriteRule ^adm/(.*)$ adm.php?mode=$1
I've used that for the example URL:
http://www.domain.com/adm/thismode
Now I want to get two methods like:
http://www.domain.com/adm/thismode/othermode
I've tried this:
RewriteRule ^adm/(.*)$/(.*)$ adm.php?mode=$1&othermod...
I am getting 403 Errors from Apache when I send too many, 12, synchronous HTTP Posts via a desktop app I am building in XCode / Objective-C. The 12 POST requests are just a few kb each and go out instantly one after the other and the Apache Error Log shows...
client denied by server configuration: /the-path/the-file.php
Apache 2.0 PHP...
I want to add an additional value into an array before passing it to json_encode function,
but I can't get the syntax right.
$result = db_query($query);
// $row is a database query result resource
while ($row = db_fetch_object($result)) {
$stack[] = $row;
// I am trying to 'inject' array element here
$stack[...
How can create simple PHP Search Engine Submission tool, which allows that to submit the site URL to multiple search engines such as "http://www.google.com/addurl?q=www.yoursite.com&hl=&dqq=" and also "http://www.bing.com/webmaster/SubmitSitePage.aspx" or any other other search engines?
...
I'm trying to search multiple fields (zc_city, zc_zip and zc_state), matching against a single value input by the user. The three columns should be included in the results. Here's what I have now:
$q = strtolower($_GET["q"]);
if (!$q) return;
$sql = "SELECT DISTINCT zc_city AS zcity FROM search_zipcodes WHERE zc_city LIKE '$q%'";
$rsd...
I'm storing Points Of Interest (POI) in PostgreSQL database, and retrieve them via PHP script to Android application. To reduce internet usage I want my mobile app to know if there are any points in the neighborhood of currently displayed area.
My idea is to store bounds of the rectangle containing all points already retrieved (in other...
I have divs that I want to display at specific times throughout the day. I have it working in PHP, but it requires refreshing the browser manually. I would like my script to automatically load the right div when the time is right.
Am I on the right track? Perhaps there is a jquery plugin for this sort of thing that would handle the refr...
I am building a class to send API calls to Rapidshare and return the results of said call. Here's how I want the call to be done:
$rs = new rs();
$params = array(
'sub' => 'listfiles_v1',
'type' => 'prem',
'login' => '10347455',
'password' => 'not_real_pass',
'realfolder' => '0',
'fields' => 'filen...