php5

Why self::function() and $self->variable or self::$variable even though there is $this->function() and $this->variable (PHP)?

I'm confused about these two keywords and the way to use them in PHP5. I think that "this" is used for instanced objects (not static) while "self" is referring to the object itself, not an instance of it and thus used within static objects. Right? Now, I believe that the correct use inside a class's static method to call another static ...

"Global" variable scope in PHP

I have a section of code like the following: ---- file.php ---- require_once("mylib.php"); function($a,$b) { $r = $_GLOBALS['someGlobal']; echo $r; } ---- mylib.php ---- $_GLOBALS['someGlobal'] = "Random String"; This is a bit trivialized, but is the exact problem I have an I haven't found some related stuff, but noth...

How can I send all php errors run on one page to an email?

Basically I have a single page on my site that I want any php erorrs, warnings, etc to be sent to me in an email every time the script is run. Edit: this must be code that is placed on the page, not an edit to php_ini or anything like that. Edit 2: this needs to catch ALL errors and send ALL errors in one email at the end of the script...

Ajax problem not displaying data using multiple javascript calls...

I'm writing an app that uses ajax to retrieve data from a mysql db using php. Because of the nature of the app, the user clicks an href link that has an "onclick" event used to call the javascript/ajax. I'm retrieving the data from mysql, then calling a separate php function which creates a small html table with the necessary data in i...

PHP Extract2 - How to assign vars in current symbol table?

I have a function, which is a safer way to extract variables than extract(). Basically you just specify which variable names are to be pulled out of an array. The problem is, how do you insert those variables into the "current symbol table" like extract() does? (ie. the local variable scope within a function). I can only do this by m...

PHP: imagepng() and transparency

When using the function imagepng() in php, how can I make sure the images that I save are saved with a transparent background? ...

Questions about iPhone emoji and web pages

 Okay, so emoji basically shows the above on a computer. Is that another programming language? So how do I put those little boxes into a php file? When I put it into a php file, it turns into question marks and what not. Also, how can I store these in a MySQL without it turning into question marks and other weird thing...

Static classes in PHP

Instead of declaring each function as "static" in a class, is there any way that I can make a class itself "static"? ...

Drawing 3D bar graphs using PHP?

I'm looking to draw a 3d bar graph similar to the one below My problem is that I can't seem to find any useful library that can do this for me, any classes available that can do this for me. I tried pchart but this does not seem to work for this, only for 3d pie charts ...

How to fill the form when user clicks on a row without refreshing the page?

I have a entry form. Below it, I want to show a grid containing existing records. As the user clicks on a row of the grid, the values must get filled in the fields of the form above. Is there any way to do this without refreshing the page? ...

setrawcookie in PHP not working properly in FF and Chrome when domain and path set

This works in Safari, FF, Chrome, etc.: setrawcookie('mycookie', 'myvalue', time() + 31556926); This does not work in FF or Chrome: setrawcookie('mycookie', 'myvalue', time() + 31556926, '/', '.localhost'); I have been using PHP for quite some time, and have never seen this behavior before. ...

oci_bind_by_name RETURNING INTO truncates value

When I insert a row into a table with 1000+ entries, and attempt to return the row ID (be it from an autoincrement trigger/seq, or from setting the value manually in the insert statement), I get a truncated value: $db = OCILogon(DATABASE_LOGIN, DATABASE_PASSWORD, DATABASE_NAME); $mysqldate = date('Y/m/d G:i:s'); $db_vid_id = 748; $auth...

How to initialize google-code project in Mercurial

I have started a Mercurial based project on google code. I have worked in subversion for sometime, but I am confused with what to do what in Hg. I would like help on the following: How do I initialize project (first on my local machine) (then from my local copy to google's server) How do I get my copy of a build from the server How do...

Calling another constructor from a constructor in PHP

I want a few constructors defined in a PHP class. However, my code for the constructors is currently very similar. I would rather not repeat code if possible. Is there a way to call other constructors from within one constructor in a php class? Is there a way to have multiple constructors in a PHP class? function __construct($service, $...

Syntax help! Php and MYSQL

Original: $sql = "SELECT DATE(TimeAdded) AS Date, $column_name FROM Codes ORDER BY TimeAdded ASC"; Altered: $sql = "SELECT DATE("m", TimeAdded ) AS Date, ColumnName FROM TableName ORDER BY TimeAdded ASC"; TimeAdded was added using NOW() and basically, I am trying to make it months. The problem I have here is the quotations is messi...

Loop and MySQL help!

Okay, basically... i am trying to store the dates and month name from my database in this format. I am aiming store the month and then count the entries in that month and then store the count. This is my loop, but I have trouble formatting the array properly. while ( $row = mysql_fetch_assoc($res) ) { if ($row['Date'] != $prev_date) {...

How to include config.php efficiently?

I'm always interested in more efficient ways and learning new things. Right now, I am using the code <?php include('config.php'); ?> in each and every file. Depending on where the file is in my the folder structure, I would have <?php include('../config.php'); ?> or even <?php include('../../config.php'); ?>. How can I make it more effi...

3D graphs using pChart

Is there a way to draw a 3D Bar Graph using the pChart library in PHP? I'm able to draw a 3D Pie graph but not a line graph. Any help would be appreciated. My code looks as follows //The 3D bar graph # // Dataset definition $DataSet = new pData; // $DataSet->AddPoint(array(10,40,30,20,30,30,20,10,10,70,40),"Serie1"); $DataSe...

SPL Autoloading best practices

In my include_path on the server-side I have a reference to a pear directory, in '/usr/share/pear/'. Within my applications I include files from a common library, living in '/usr/share/pear/library/' with require_once 'library/file.php'. I've recently started using the spl autoloader, I noticed in the loader function you have to determ...

PHP Framework support for legacy PHP4?

I know that PHP4 is "dead", however there are about two dozen or so of our clients that still are located on servers where PHP4 is used, and we won't get any server upgrades until around a year or two. I'm just about to start working on refactoring and improving our core web framework, which is now coded for the lowest common denominato...