I don't get this: They say, it is good to make a "Base Controller" that instantiates the database and session:
// Base Controller code
$this->db = Database::instance($db_group);
$this->session = Session::instance();
// Now in any controller which extends Base Controller
$var = $this->session->get('var');
$query = $this->db->query('SELEC...
We have a really old legacy code base that uses globals like they're going out of fashion - nearly all of the inter-page communication is done via globals and sessions or both. This could be changed as a last resort but ideally I don't want to touch any of it as everything I touch could introduce more bugs :-p.
Anyway, We're incorporati...
Can anybody suggest the best way of keeping the formatting intact of a text field - ie. keeping the line breaks or carriage returns in mysql and then recognising them when the form is populated on login?
Currently when the textfield data is stored (in a TEXT field in mysql) its losing the carriage return values and adding a small square...
can anyone tell me how to read up to 3 remote files and compile the results in a query string which would now be sent to a page by the calling script, using headers.
Let me explain:
page1.php
$rs_1 = result from remote page a;
$rs_2 = result from remote page b;
$rs_3 = result from remote page c;
header("Location: page2.php?r1=".$rs_1...
I'm have a web page where I have a div within which there is a somewhat complex DOM tree. It displays fine across most browsers(IE 6-8, FF 2.x-3.5.x, Chrome, Safari) but when I try to print the page I'm having some cross-browser problems, some work half some of the time and others don't work at all.
I had the idea that if I could send o...
i have some entries which are having data month-wise
like
May-2009
April-2009
March-2009
-
-
-
-
-
-
January-2000
Now i want this data to be sorted monthly via mysql query.
$q=mysql_query(SELECT id,action,
L1_data,
L2_data,
L3_data,
L11_data
from table
where action='feild name'
ORDER BY DATE_FORMAT(L11_d...
Hi -
When I use current_timestamp with MySQL, I get the correct time, but when I use
$mysqldate = date( 'Y-m-d H:i:s' );
I get the date with with an hour delay (eg, 4:42 PM is 5:42 PM).
I understood that both function use the server's local time - can someone explain the difference?
Thanks.
...
To get started with Kohana quickly, I wonder if someone has ever made an sleek skeleton project that makes use of all basic things every web developer needs:
basic user authentification with login
retrieving some stuff from an MySQL database and displaying it
By hand I would do this pretty fast. But with Kohana it feels like I have t...
In a PHP script I'm accepting input from the user from a textarea and want to allow a few basic tags. So when I output the string I'm using -
echo strip_tags($content, '<b><i><ul><ol><li>');
Now normally I would use FILTER_SANITIZE_STRING but that would strip all tags and I would use html_entities() but that would prevent the tags I'm...
I'm interested in modifying a template in a wordpress install to show related posts ... in my case, I think I'd be fine with just showing the latest 5 posts in the current post's category.
How would one do that without installing a plugin? I would rather modify the template in this instance
I've poked around on google trying to find...
ldap
LDAP Support enabled
RCS Version $Id: ldap.c,v 1.161.2.3.2.12 2007/12/31 07:20:07 sebastian Exp $
Total Links 0/unlimited
API Version 2004
Vendor Name OpenLDAP
Vendor Version 0
I have changed, now i am not sure what i have to do further to make sure windows username and password works for the MediaWiki too.... ...
How do I create a loading overlay(with loading gif) while php script runs and returns data
...
Hi all,
Is it possible to request some data in a Flash movie from PHP at run-time? Maybe my real-world implementation can clarify some things:
I use a Flash movie to store a Local Shared Object (because for some reason I need LSO's instead or regular PHP cookies).
Now, when I load up a PHP file I want to somehow retrieve the data fro...
I'm trying to get PHP compiled with EXIF support. Every time I try to build PHP 5.2.9 on my virtual dedicated server running CentOS 5.3, it fails when it gets to building zend_execute.lo. I tried compiling just that file by itself, and it fails. Says out of memory allocating [####] bytes after... something.
How can I get PHP compiled...
I would like to change a string in php from all upper case to normal cases. So that every sentence would start with an upper case and the rest would be in lower case.
Is there a simple way to do this ?
...
Hi,
I know you can use both $_GET and $_POST at the same time, but is this a required "feature"? I am writing a framework, where you can access input through:
$value = $this->input->get('name','');
$value = $this->input->post('name','');
$value = $this->input->cookies('name','');
I'm just thinking here, is there a need for having GET...
Normally, if I want to force a link to open in a new tab (or window) when posting to my blog, I have to either use the link GUI and select "open in new window", or, since I use the HTML view by default, after inserting a link, manually add the "target=" portion of the tag:
<a href="http://link.to/something.great" target="_blank">link te...
Hi,
I need to pass a value from PHP to C++, this I think I can do with PHPs passthru().
Then I want C++ to do something to that value and return the result to PHP.
This is the bit I can't work out, does anyone know how to pass data from C++ to PHP?
I'd rather not use an intermediate file as I am thinking this will slow things down.
Than...
Can someone explain to me what the difference between
include_once 'classb.php'
class A
{
$a = new B
}
and
class A extends B
{
$a = new B
}
is?
What advantages/disadvantages are there to extending a class vs. including the .php file?
...
Hi,
I am writing a set of classes: RAR, ZIP and Trip. They all share a common interest: they are archive formats. So, I initially thought about doing this:
1) Write a base abstract class
abstract class Archive {}
and place it at "libraries/archive/archive.php".
2) Write zip, rar and trip classes
class Archive_Zip extends Archive ...