php

MySQL / PHP: Date functions for page view statistics and popularity...

Hi, I have a table with number of page views per day. Something like this: +------+------------+------+ | id | date | hits | +------+------------+------+ | 4876 | 2009-07-14 | 4362 | +------+------------+------+ | 4876 | 2009-07-15 | 1324 | +------+------------+------+ | 7653 | 2009-06-09 | 5643 | +------+------------+------+ ...

Excel BIFF file format - cell type for date

Hello! I'm trying to write an excel file from php, and I need that some cells to have date type; do you have any ideas which is the format code for that type of cell? I'm using the code from http://pizzaseo.com/php-excel-creator-class to generate the excel files. Thanks. ...

when/where we use XMLRPC

I hared that many of the blog sites were using this protocol, i just want to know what is that when/where we use this XMLRPC Any Example with PHP would be appreciable :) I didnt see any kind of question like this in stack Overflow. Thanks in Advance !! ...

generating unique combinations without running out of memory in php

I am writing an algorithm to generate combinations of items from a database. They need to be unique permutations (i.e. 145, 156 == 156, 145). The problem I am running into is how to keep track of previous combinations so that i do not end up with 145, 156 and 156, 145. Currently I am adding them to an array with index of id1_id2... (so...

Netbeans 6.7 PHP - How to highlight PHP Code in HTML files?

Hi, Is there any way to tell Netbeans to highlight PHP code in HTML files? I am using Zend Framework, where a lot of PHP code is included in the view files. ...

Is it possible to check PHP file syntax from PHP?

I load dynamically PHP class files with autoload. And those files could be missing or corrupted by some reason. Autoload will successfully report missing files so application logic could handle that. But if those files are corrupted, then the whole processing halts with blank screen for the user and "PHP Parse error: syntax error" in er...

Looping through mysql_fetch_array in PHP

So I have the following: $i = 0; $records = mysql_num_rows($sections_query); $row_sections = mysql_fetch_array($sections_query); foreach ($row_sections as $value) { echo $value . "<br />"; } The value of $records becomes 4 after execution and the DB has 2 columns per row. The first column value is 'section_id' and the second ...

Modifying PHP superglobals other than $_ENV

In PHP I want to be able to set a variable value "superglobally" - that is a me-defined value that is accessible to EVERY script that runs on the server at its FIRST line of code (i.e. without having to require_once() anything or anything like that). Currently I'm using $_ENV[ 'varname' ] by setting an environment variable on my system ...

formatting fgetcsv output

Im trying to figure out how to take the data returned by fgetcsv, and format it into a readable/editable table, and then use fputcsv to save that table so far i have this <?php $row = 1; $handle = fopen("csv.csv", "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); $row++; for ($c=0; $c < $n...

JavaScript Date Object's month index begins with 0!

My goal is to convert a timestamp from MySQL into a JavaScript Date object in an efficient manner. Here is my current snippet that converts the MySQL timestamp into a formatted date in PHP: <?php // formats timestamp into following format: 2009, 7, 30 $date = date("Y, n, j", strtotime($row["date"])); ?> I am then using this $date va...

Does someone have a PHP function to properly capitalize people names?

I'm looking for a function to properly capitalize names like McDonald, FitzGerald, MacArthur, O'Lunney's, Theo de Raadt, etc. Does anyone know of one that works resonably well? I'm guessing any function is not going to support every possibility. Of course ucwords alone doesn't work for this because it just capitalize the first letter o...

Loop nesting and I'm getting a blank page (php)

Here's what I got- $awards_sql_1 = mysql_query('SELECT * FROM categories WHERE section_id = 1') or die(mysql_error()); $awards_rows_1 = mysql_num_rows($awards_sql_1); $awards_sql_2 = mysql_query('SELECT * FROM categories WHERE section_id = 2') or die(mysql_error()); $awards_sql_3 = mysql_query('SELECT * FROM categories WHERE section...

Force IE draw screen while completing a PHP call

Hi, I have a PHP app that sends emails via the mail command (around 200) and would like to display them on the screen as they are sent, but IE only refreshes the screen at the end of the process. Is there a way to display the list as we go along? Thanks! ...

Auto-load function / class libraries when needed

First, a little background. The company I work for uses a massive function / class library, which gets included on every single page. Thousands and thousands of lines of functions, 90% of which probably won't even be called on a page. In an attempt to lighten the server load a little, I've been experimenting with smarter library setups....

Does PHP's ArrayObject have an in_array equivalent?

PHP has an in_array function for checking if a particular value exists in an native array/collection. I'm looking for an equivalent function/method for ArrayObject, but none of the methods appear to duplicate this functionality. I know I could cast the ArrayObject as an (array) and use it in in_array. I also know I could manually iter...

Oracle Gotchas for An Experienced Newb

What are some Oracle gotchas for someone new to the platform, but not new to relational databases (MySQL, MS SQL Server, Postgres, etc.) in general. Two examples of the kind of things I'm looking for Many relational database products handle creating an auto_increment key for you. Oracle does not, you must manually create the sequence...

PHP/HTML/CSS: IE acting weird when using require_once()

Now this is the most weird problem I've ever had in PHP. All pages looks normal except one; when I first saw the problem I thought it was one of these common problems with IE and stylesheets (I've got a specific CSS-file on this page). I tried to exclude the CSS-file just to ensure that the problem really was in this file, but it wasn't...

Getting Wordpress navigation inside another page

I'd like to only get the worddpress navigation (header, navigation menu, footer) so I can add custom pages to the site which can easily integrate in the general template of the side while showing other things in the center instead of blog postings? Edit: To clarify, I'd either like to know if there's an easy way to include the function...

why ob_start gzandler is throwing following error on browser ?

The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression. ...

Update statement throwing an error.

function updateDemo($demoTitle, $desc, $keyword, $linkTitle, $clientname, $imageTitle, $adminName, $demoID) { $query = "UPDATE demos SET demoTitle ='$demoTitle' , dmDesc = '$desc' , dmKey = '$keyword' , dmLink= '$linkTitle' , client='$clientname' , imageTitle = '$imageTitle' , userName = '$adminName' W...